[systemd-devel] Help writing a user service file that will exec a command upon system sleep

John da_audiophile at yahoo.com
Wed Oct 28 12:30:17 PDT 2015


I have a simple bash script that I would like to have a user service file run with an argument when the system enters a sleep or hibernation state but as I understand it, user service units do not use the sleep.target.  The goal is to have the following run before the system goes into sleep/hibernate triggered by whatever mechanism systemd uses to detect when the user sleeps or hibernates the system: '/usr/bin/psd sync'

My current user unit is linked below (psd.service).
https://github.com/graysky2/profile-sync-daemon/tree/master/init

Thank you in advance for your suggestions.


More information about the systemd-devel mailing list