0

Is it possible to have a script invoked when my PC decides to sleep or when it is put to sleep manually.

What I am trying to do is to have a script that will take down my VPN and the SSH key, when sleep happens. I don't use hibernate these days, otherwise I would have been interested in that event as well.

Is there some sort of setup that can be done to handle a dbus event? Does the power management fire off such events?

Any pointers will be of great help. I would prefer to do it in the normal user land; i.e no root privileges. I am more in bed with KDE than any other DE; but I wouldn't mind a more generic solution that I can take along to any other DE.

CodeMedic
  • 130

1 Answers1

0

refer pm-action man page: http://manpages.ubuntu.com/manpages/trusty/man8/pm-action.8.html, and refer the FILES section.

Any executable script put in the directory /etc/pm/sleep.d/ will be invoked before the suspend happens. Putting a file here will require sudo.

Bhavin Doshi
  • 2,496