#!/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