2

A previous post used info that is outdated for Ubuntu Mate 18.04.

According to this article, Running scripts before and after suspend with systemd, I have this script in /lib/systemd/system-sleep/:

#!/bin/bash 
#
# located in /lib/systemd/system-sleep/
# Created 4/2/19
exec 2> /tmp/systemd_suspend_test_err.txt
if [ "${1}" = "pre" ]; then
  # Do the thing you want before suspend here
  echo "we are suspending." > /tmp/systemd_suspend_test.txt
elif [ "${1}" = "post" ]; then
  # Do the thing you want after resume here
  echo "and we are back from being suspended" >> /tmp/systemd_suspend_test.txt
fi

However, none of the echo statements work.

1 Answer 1

4

I feel kind of stupid, but I forgot to set the execute bit. Now the script works after I used:

chmod +x
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .