1

A previous post used info that is out of date for Ubuntu Mate 18.04.

NOT a duplicate.

According to this info

https://blog.christophersmart.com/2016/05/11/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

None of the echo statements work.

4

I feel kind of stupid, but I forgot to set the execute bit.

Now the script works.

I used chmod +x

1
  • Can you please add the command that you used to 'set the execute bit'? – earthmeLon Apr 2 '19 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.