add battery control for syncthing
This commit is contained in:
commit
afd6bee7c0
10
lowbat.sh
Executable file
10
lowbat.sh
Executable 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
|
10
onbat.sh
Executable file
10
onbat.sh
Executable 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" "Terminating to save power." "Restart manually if you need $SERVICE." --icon=dialog-information
|
||||||
|
## kill syncthing
|
||||||
|
syncthing cli operations shutdown
|
||||||
|
fi
|
14
onpower.sh
Executable file
14
onpower.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SERVICE="syncthing"
|
||||||
|
if pgrep -x "$SERVICE" >/dev/null
|
||||||
|
then
|
||||||
|
notify-send -a $SERVICE -h "string:desktop-entry:org.kde.konsole" "We're already up and running" --icon=dialog-information
|
||||||
|
|
||||||
|
else
|
||||||
|
## notify user that syncthing is restarting
|
||||||
|
notify-send -a $SERVICE -h "string:desktop-entry:org.kde.konsole" "Starting up because power is back!" --icon=dialog-information
|
||||||
|
## start syncthing
|
||||||
|
/usr/bin/syncthing serve --no-browser --logfile=default
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue