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
Bash
Executable File

#!/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
else
echo "$disconnect1" # /
sleep 0.6
echo "$disconnect2" # \
sleep 0.6
fi
done