2

This script is in /etc/pm/sleep.d/.

I used this as a guide. I am using Ubuntu Mate 18.04.

https://superuser.com/questions/733333/how-do-i-run-commands-on-suspend-return-from-suspend

Execute bit is set.

When my computer resumes, nothing happens.

#!/bin/sh

case "$1" in
suspend|hibernate)
    #actions to take on suspend or hibernate
    ;;
resume|thaw)
    #other actions to trigger on resume
    gxmessage -fg red -font  'sans 30' -timeout 3  ' Computer has now resumed from suspend state.'
    ;;
esac

I found this in syslog.

Mar 31 02:00:51 7 dbus-daemon[932]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.95' (uid=0 pid=16760 comm="geany /etc/pm/sleep.d/On_Resume.sh " label="unconfined

I have no /var/log/pm-suspend ?

14
  • What do you expect this script to do exactly? I see many problems with the way you are trying to do this. 1) you should put the full path of the executable, because the PATH variable might not be defined, or be defined completely differently that what you expect it to be. 2) how do you know that at the moment of the execution, that program gxmessage has access to a monitor to display you something? and to which monitor will you send this output? This is not specified in the parameters, so probably you have to wrap this around a more complex script that defines those things for it. – dadexix86 Mar 31 '19 at 21:16
  • Also, it might be useful to know on which version of Ubuntu you are on, and which guide you are following to do what you are doing, because there might be a completely different way of doing it in your current version (using systemd, for example, instead of pm). – dadexix86 Mar 31 '19 at 21:17
  • @dadexix86 I added that info to my post. – fixit7 Mar 31 '19 at 21:22
  • Yeah, I suspected that the guide you were following was greatly outdated. I mean, 5 years is really a lot! Try by following this guide blog.christophersmart.com/2016/05/11/… and see if the example works (i.e. it creates the file /tmp/systemd_suspend_test and fills it with the proper things inside) – dadexix86 Mar 31 '19 at 21:32
  • 1
    I found out that the link I provided is out of date. I will make a new post. – fixit7 Apr 2 '19 at 22:30

Your Answer

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

Browse other questions tagged or ask your own question.