I need to lock the screen when my computer is waken up from memory suspend,

So I tried to put the following script to /usr/lib/pm-utils/sleep.d and /etc/pm/sleep.d, but it never got executed,


case "$1" in
        vlock -ans
    *) exit $NA

P.S It's pm-suspend not pm-hibernate.


Tried systemd service as well, no luck:

# /etc/systemd/system/resume@.service
Description=User resume actions

ExecStart=vlock -ans


And I called systemctl enable resume@.service too, vlock wasn't called still.

  • 3
    Are you sure it will not get executed? Can you try to just log it or do something like echo executed script >> /tmp/resume Dec 26 '12 at 13:50

AFAIK ExecStart wants a full path to the executable.

Try with ExecStart=/usr/bin/vlock -ans in your /etc/systemd/system/resume@.service


Did you set the permissions and owner as described in the wiki?

Make sure the script is executable (chmod 755) and owned by root:root


You're trying to create your own hook, right? I'm reading the Arch Linux documentation on pm-utils (link below) and I'd check these things first:

  • script name (start with two digits, obeying the scheme in the docs)
  • script location: /etc/pm/sleep.d is the right place
  • script modes: chmod +x /etc/pm/sleep.d/66scriptname

If you're sure you've got all those right, then consider the script itself.

Here's a link to the docs I'm reading about this: https://wiki.archlinux.org/index.php/pm-utils#Creating_your_own_hooks

Your script isn't quite like the one they show there. You invoke /bin/sh instead of /bin/bash. You use double-qoutes around $1 and they don't. You combine options and they don't. All of which should be OK, right? Except maybe the sh versus bash.

How about putting some logger or echo statements in there for debugging and then check the logs to see if you script is getting started. And if it is, how far it's getting.

  • Does systemd work with pm-utils? I'm not sure about that ;-)
    – daisy
    Nov 6 '13 at 0:09

I found out all the directories by doing a "sudo strace pm-hibernate 2>/root/myfile.log", or you can replace the pm-hibernate with pm-suspend. After sometime the machine will powerdown. Then when you powerup / resume again, read the myfile.log, and within it are all the scripts, config, log files accessed/written.

For my Fedora 20 they are:


etc and several other directories.

Help yourself with your specific distro of specific version (Fedora 20 is using systemd btw).

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.