check availability of web services

This commit is contained in:
tavo-wasd 2023-12-26 11:06:46 -06:00
parent 6914e44be9
commit 2a363ecd11
3 changed files with 19 additions and 3 deletions

View file

@ -2,10 +2,12 @@
HOST="$1"
print_yes() {
printf '\033[2m%s:\033[0m \033[1m\033[32mYES\033[0m\n' "$1"
#printf '\033[2m%s:\033[0m \033[1m\033[32mYES\033[0m\n' "$1"
printf '%s: YES\n' "$1"
}
print_no() {
printf '\033[2m%s:\033[0m \033[1m\033[31mNO\033[0m\n' "$1"
#printf '\033[2m%s:\033[0m \033[1m\033[31mNO\033[0m\n' "$1"
printf '%s: NO\n' "$1"
}
if ! ping -c 1 "$HOST" > /dev/null 2>&1; then

13
scripts/status/isitup-notify Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
ID_START=21
while true ; do
for HOST in "$@" ; do
DOWN_STATUS="$(isitup "$HOST" | grep 'NO')"
! [ -z "$DOWN_STATUS" ] &&
notify-send "$HOST" "$DOWN_STATUS" -t 0 -u critical -r "$ID_START"
ID_START=$((ID_START+1))
done
sleep 3600
done

View file

@ -4,6 +4,7 @@
type systemctl 2>/dev/null 1>&2 && if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
cat ~/Documents/snippets/welcome
sleep 0.5
amixer
amixer &
isitup-notify $(cat ~/Documents/websites | sed 's/\s*#.*//g;/^$/d') &
exec startx
fi