This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-skel/home/bin/check-network

21 lines
459 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
disconnect1="/"
disconnect2="\\"
wconnected=""
econnected=""
id="$(ip link | awk '/state UP/ {print $2}')"
while true; do
if ping -c 1 archlabslinux.com >/dev/null 2>&1 || ping -c 1 archlinux.org >/dev/null 2>&1; then
[[ $id == e* ]] && echo "$econnected" || echo "$wconnected"
sleep 25
2018-07-16 01:55:17 -05:00
else
echo "$disconnect1" # /
sleep 0.6
echo "$disconnect2" # \
sleep 0.6
fi
done