add battery control for syncthing

This commit is contained in:
sakrecoer 2024-11-20 16:35:57 +01:00
commit afd6bee7c0
3 changed files with 34 additions and 0 deletions

10
lowbat.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
SERVICE="syncthing"
if pgrep -x "$SERVICE" >/dev/null
then
## notify user that syncthing is stopping
notify-send -a $SERVICE -h "string:desktop-entry:org.kde.konsole" "Lowbatts, terminating $SERVICE to save power." "Recharge before using $SERVICE." --icon=dialog-information
## kill syncthing
syncthing cli operations shutdown
fi