blob: d0fda52fcbcd0f3f233e9145f3d20d172d03bf6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/bin/bash
. $HOME/.shenv
# someday, make this work instead:
# <http://joeyh.name/blog/entry/a_programmable_alarm_clock_using_systemd/>
(($EUID == 0)) || exec sudo "$0" "$@"
WHEN="${1:-tomorrow 6am}"
CMD="/home/spwhitton/bin/goodmorning"
when=$(date +%s -d "$WHEN")
loginctl lock-sessions
systemd-inhibit --what=handle-lid-switch --why=goodmorning sh -c \
"rtcwake -m mem -t $when && /bin/su spwhitton -c $CMD"
|