22 lines
528 B
Bash
Executable File
22 lines
528 B
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
main(){
|
|
connected_val="$(iwgetid 1> /dev/null ; echo $?)"
|
|
if [ $connected_val -eq 255 ]; then
|
|
echo '{"text": "⚠ Disconnected", "class":"disconnected"}'
|
|
return
|
|
else
|
|
wg_val="$(wg 2> /dev/null ; echo $?)"
|
|
if [ $wg_val -eq 0 ]; then
|
|
echo "{\"text\": \" $(iwgetid -r)\", \"class\":\"connected\"}"
|
|
else
|
|
echo "{\"text\": \"聯 $(iwgetid -r)\", \"class\":\"secured\"}"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
while true; do
|
|
main
|
|
sleep 1
|
|
done
|