Created
October 10, 2018 20:27
-
-
Save norrs/ac102727be5ae10d0628dd169e68cf04 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
systemctl cat --user git-sync-powersavehelper | |
# /home/norangshol/.config/systemd/user/git-sync-powersavehelper.service | |
[Unit] | |
Description = Disable and Enable git-sync depending on AC power | |
ReloadPropagatedFrom = sys-susbsystem-power_supply-main_AC.device | |
[Service] | |
ExecStart = /usr/bin/env git-sync-powersavehelper | |
ExecReload = /usr/bin/env git-sync-powersavehelper | |
RemainAfterExit=true | |
[Install] | |
WantedBy = sys-subsystem-power-supply-main_AC.device | |
norangshol@enceladus:~$ cat ~/.local/bin/git-sync-powersavehelper | |
#!/usr/bin/env sh | |
if /lib/systemd/systemd-ac-power ; then | |
echo "Power On: $(date)" | |
else | |
echo "Battery On: $(date)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ systemd-analyze verify --user git-sync-powersavehelper.service
norangshol@enceladus:~$ echo $?
0