Created
December 16, 2017 17:09
-
-
Save w-vi/c4283607754e660b6b713310cefbde05 to your computer and use it in GitHub Desktop.
User action on suspend/hybernate/resume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/[email protected] | |
[Unit] | |
Description=User resume actions | |
After=suspend.target | |
[Service] | |
User=%I | |
Type=simple | |
ExecStartPre=/usr/local/bin/ssh-connect.sh | |
ExecStart=/usr/bin/mysql -e 'slave start' | |
[Install] | |
WantedBy=suspend.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/[email protected] | |
[Unit] | |
Description=User suspend actions | |
Before=sleep.target | |
[Service] | |
User=%I | |
Type=forking | |
Environment=DISPLAY=:0 | |
Environment=HOME=%h | |
#ExecStartPre= Do whatever you need before sleep, stop some services etc | |
ExecStart=-/usr/bin/xscreensaver-command -lock | |
ExecStartPost=/usr/bin/sleep 1 | |
[Install] | |
WantedBy=sleep.target | |
# systemctl enable suspend@<user>.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment