2

I have the desire to run a script as the logged in user immediately before a hibernate (suspend to disk) operation, and immediately after a resume with KDE4.

I know that I can put a script in /etc/pm/sleep.d that will do this, but such a script must be non-interactive, and will run as root.

I need this script to run as a the user logged in to KDE, and the post-resume script would ideally be interactive.

I can see where I can run a script on suspect in KDE, but it's imperfect:

System Settings -> Power Management -> Advanced Settings -> Configure Notifications

This allows me to specify a command to run on resume, however...

  1. It doesn't appear to distinguish between Suspend to RAM and Suspend to disk (alone, not a deal breaker, but I really only need to run my command on suspend-to-disk)
  2. It doesn't have any option to run a script on resume, which is actually the most important part I need.

Ultimately, what I'm trying to accomplish is to auto un-mount my Windows partition when I hibernate, so that the filesystem will be consistent whenever I boot into Windows. This is best done as the user, and with interaction, because the partition is encrypted with TrueCrypt, and I prefer entering the passphrase after resuming, rather than having it stored on the filesystem.

I do realize that I can automate much of this if I'm willing to run as root, and non-interactively, so please don't suggest these as alternatives. I may end up doing that, but that's not what this question is about.

1 Answer 1

0

Only similar thing I've found are hooks on lower level provided by pm and systemd hooks:

https://wiki.archlinux.org/index.php/pm-utils

https://wiki.archlinux.org/index.php/Power_Management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep

You must log in to answer this question.

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