Run script on resume
by KFoltz from LinuxQuestions.org on (#5MVEG)
I am trying to run a script on resume after system suspend. Placed a script called test in /lib/systemd/system-sleep. Set the execution bit.
#!/usr/bin/env bash
#
# useless test script
#
echo "Reached test script at $(date)" >> tmp/result.txt
case "$1/$2" in
pre)
echo "we are suspending at $(date)..." >> tmp/result.txt
;;
post)
echo "we restarted at $(date)" >> tmp/result.txt
;;
esac
The script properly appends "Reached test script at $(date)" in tmp/result.txt when ran from terminal.
There is nothing placed in tmp/result.txt on suspend or resume.
journalctl -u systemd-suspend.service doesn't show any error messages.
Anyone have any idea what is wrong?
#!/usr/bin/env bash
#
# useless test script
#
echo "Reached test script at $(date)" >> tmp/result.txt
case "$1/$2" in
pre)
echo "we are suspending at $(date)..." >> tmp/result.txt
;;
post)
echo "we restarted at $(date)" >> tmp/result.txt
;;
esac
The script properly appends "Reached test script at $(date)" in tmp/result.txt when ran from terminal.
There is nothing placed in tmp/result.txt on suspend or resume.
journalctl -u systemd-suspend.service doesn't show any error messages.
Anyone have any idea what is wrong?