mirror of
https://github.com/JanJastrow/.dotfiles.git
synced 2024-11-22 10:39:57 +01:00
Add ping/pushover scripts
This commit is contained in:
parent
2737a4e86d
commit
65275991de
24
zsh/scripts
24
zsh/scripts
@ -98,3 +98,27 @@ function extract () {
|
|||||||
echo "'$1' is not a valid file"
|
echo "'$1' is not a valid file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Monitor IP/Host and report with Pushover
|
||||||
|
pnotify-online() {
|
||||||
|
local ip_address="$1"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
if ping -c 1 -W 1 "$ip_address" >/dev/null; then
|
||||||
|
echo "$1 is online now."
|
||||||
|
pushover "$1 is online now."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
pnotify-offline() {
|
||||||
|
local ip_address="$1"
|
||||||
|
while true; do
|
||||||
|
if ! ping -c 1 -W 1 "$ip_address" >/dev/null; then
|
||||||
|
echo "$1 is offline now."
|
||||||
|
pushover "$1 is offline now."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user