我认为 /lib/systemd/system-sleep/ 中的脚本是在计算机从睡眠状态恢复时运行的。(按下计算机上的睡眠按钮。)
除 cvlc 线外,一切正常。
#!/bin/sh
if [ "${1}" == "pre" ]; then
# Do the thing you want before suspend here, e.g.:
echo "we are suspending at $(date)..." > /tmp/systemd_suspend_test
cvlc --play-and-exit /usr/share/sounds/My_Sounds/Short_doorbell.wav
elif [ "${1}" == "post" ]; then
# Do the thing you want after resume here, e.g.:
echo "...and we are back from $(date)" >> /tmp/systemd_suspend_test
cvlc --play-and-exit /usr/share/sounds/My_Sounds/Short_doorbell.wav
fi
我想我在日记里找到了线索。
Sep 10 06:36:12 7 systemd-sleep[8316]: VLC is not supposed to be run as root. Sorry.
Sep 10 06:36:12 7 systemd-sleep[8316]: If you need to use real-time priorities and/or privileged TCP ports
Sep 10 06:36:12 7 systemd-sleep[8316]: you can use /usr/bin/vlc-wrapper (make sure it is Set-UID root and