initial commit
This commit is contained in:
35
status-ip.sh
Executable file
35
status-ip.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURDIR=$(dirname "$(readlink -f "$0")")
|
||||
source "$CURDIR"/shared.so
|
||||
|
||||
IP=$(wget -T 5 -q -O - $IPSERV4)
|
||||
EXIT="$?"
|
||||
|
||||
if [ "$var_conn" == "on" ]; then
|
||||
if $(echo $IP | grep -qE "$VPNIP"); then
|
||||
IMAGE="/usr/share/icons/gnome/16x16/apps/gnome-monitor.png"
|
||||
TEXT="VPN ($IP)"
|
||||
echo "<img>$IMAGE</img>"
|
||||
elif ([ "$EXIT" == 4 ] || [ "$EXIT" == 6 ] || [ "$EXIT" == 28 ]); then
|
||||
EXIT="fail"
|
||||
TEXT="t/o"
|
||||
else
|
||||
TEXT="$IP"
|
||||
fi
|
||||
|
||||
echo "<txt> $TEXT</txt>"
|
||||
|
||||
# If request was successful, try IPv6 as well
|
||||
if [ "$EXIT" != "fail" ]; then
|
||||
IP6=$(wget -T 5 -q -O - $IPSERV6)
|
||||
EXIT="$?"
|
||||
if ([ "$EXIT" == 4 ] || [ "$EXIT" == 6 ] || [ "$EXIT" == 28 ]); then
|
||||
IP6="t/o"
|
||||
fi
|
||||
echo "<tool>IPv6: $IP6</tool>"
|
||||
fi
|
||||
else
|
||||
echo "<txt>offline</txt>"
|
||||
echo "<tool>Offline status is set. Turn on to enable checks</tool>"
|
||||
fi
|
||||
Reference in New Issue
Block a user