Initial commit
This commit is contained in:
23
smartsleepd
Executable file
23
smartsleepd
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
checkSleep() {
|
||||
if timeout 15 bash -c '
|
||||
until journalctl -b | grep -i "systemd-sleep\|sleep\.target" | tail -n1 | grep -iq "Stopped target"; do
|
||||
sleep 0.5
|
||||
done';
|
||||
then
|
||||
logger -t "SmartSleep" "Das System hat den Energiesparmodus beendet"
|
||||
return 0
|
||||
else
|
||||
logger -t "SmartSleep" "Das System hat den Energiesparmodus nicht wie erwartet beendet"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
trap 'checkSleep && systemctl suspend' USR1
|
||||
trap 'notify-send "SmartSleep" "Energiesparmodus beendet"; checkSleep' USR2
|
||||
|
||||
while true; do
|
||||
sleep infinity &
|
||||
wait $!
|
||||
done
|
Reference in New Issue
Block a user