systemd restart service on resume

Heinz Diehl htd at fritha.org
Sun Dec 8 17:22:37 UTC 2013


On 08.12.2013, Greg Woods wrote: 

> I am trying to find a way to get a service to restart when the system is
> resumed from suspend or hibernation.

You can place a script in /usr/lib/systemd/system-sleep like
this. Replace <placeholder> with your own script you want to have
executed when the system is waking up.

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    ;;
  post/*)
    echo "Waking up from $2..."
    <placeholder>
    ;;
esac



More information about the users mailing list