Last active
November 14, 2021 01:43
-
-
Save mariodian/3b8e96e62a0eeb62ba0cf3d45a4e1170 to your computer and use it in GitHub Desktop.
Check status of systemd services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL="https://freedomnode.com/server-maintenance" | |
if [ "`wget -qO- $URL | sed -e 's/<[^>]*>//g' 2> /dev/null`" != "true" ]; then | |
SERVICES=(bitcoind lnd monerod btcpayserver nbxplorer thunderhub electrs tor nginx) | |
TITLE="Services alert!" | |
MESSAGE="" | |
for SERVICE in "${SERVICES[@]}" | |
do | |
STATUS=$(systemctl is-active $SERVICE) | |
if [ "$STATUS" != "active" ]; then | |
MESSAGE+="$SERVICE: <font color=\"#DC143C\">$STATUS</font> <br>" | |
fi | |
done | |
echo $MESSAGE | |
if [ ! -z "$MESSAGE" ];then | |
pushover "$TITLE" "$MESSAGE" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment