]> rtime.felk.cvut.cz Git - novaboot.git/blob - server/systemd/novaboot-power
nix: Update flake inputs
[novaboot.git] / server / systemd / novaboot-power
1 #!/bin/sh
2
3 if [ -z "$SUDO_USER" ]; then
4     echo >&2 "$0 must be invoked via sudo"
5     exit 1
6 fi
7
8 case "$1" in
9     on)
10         systemctl stop  "novaboot-power-off@${SUDO_USER}.timer"
11         systemctl start "novaboot-power@${SUDO_USER}.service"
12         ;;
13     off)
14         systemctl stop "novaboot-power@${SUDO_USER}.service"
15         ;;
16     delayed-off)
17         systemctl start "novaboot-power-off@${SUDO_USER}.timer"
18         ;;
19     *)
20         echo >&2 "Invalid argument"
21         exit 1;;
22 esac