Explore my side projects and work using this link

“Death is so terribly final, while life is full of possibilities”

― George R.R. Martin, A Game of Thrones

Connection check script

Written in

by

#!/bin/bash
x=`ping -c1 google.com 2>&1 | grep unknown`
if [ ! "$x" = "" ]; then
        echo "It's down!! Attempting to restart."
        service network restart
fi

# you can swap "service network restart" with "netplan apply" depending on your linux distro.

Tags

Leave a Reply

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