#!/bin/bash out_ip="1.1.1.1" out_fallback_ip="8.8.8.8" out_domain="archlinux.org" out_fallback_domain="google.com" go_again=false RED='\033[0;31m' GREEN='\033[0;32m' NC='\033[0m' # No Color out_ipf() { echo -e '\033[1m[..] Checking if I can reach the outside internet...' ping -c 2 $out_ip &> /dev/null if [[ $(echo $?) = 0 ]] then out_ipw=true echo -e "\033[1m[$GREEN✓$NC] Outside Internet is working\033[0m" notify-send -t 1000 -i network-wireless 'Outside Internet is working!' -u critical else out_ipw=false echo -e "$RED\033[1m[❌] Outside Internet is not accesible\033[0m$NC" fi } out_domainf() { echo -e '\033[1m[..] Checking if I can reach DNS...' nslookup $out_domain &> /dev/null if [[ $(echo $?) = 0 ]] then out_domainw=true echo -e "\033[1m[$GREEN✓$NC] DNS is working\033[0m" notify-send -t 1000 -i network-wireless 'DNS is working!' -u critical else out_domainw=false echo -e "$RED\033[1m[❌] DNS is not accesible\033[0m$NC" fi } check_go(){ if [[ $out_ipw ]] then true else go_again=true fi if [[ $out_domainw ]] then echo Done! else go_again=true fi } go_again=true while [[ $go_again ]] do out_ipf out_domainf check_go sleep $1 done