[Script] Checking Internet Connection on Linux

0 Shares

This script is used to check internet connections on linux, create a new file with the format. Sh (bash) and execute with the command # bash namafile.sh

#!/bin/bash
ping -c 4 192.168.10.1
let a=$?
if [ "$a" = "0" ]; then
echo "We have connection."
else
echo "We have lost connection.."
#add command for reboot or restarting networking service here.
fi

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *