Article 5MVEG Run script on resume

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?latest?d=yIl2AUoC8zA latest?i=6WEPHiOqtxo:xz10Ro2Qmho:F7zBnMy latest?i=6WEPHiOqtxo:xz10Ro2Qmho:V_sGLiP latest?d=qj6IDK7rITs latest?i=6WEPHiOqtxo:xz10Ro2Qmho:gIN9vFw6WEPHiOqtxo
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments