Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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