Home » Scripts

Bash Script to restart your Network Services Periodically

Just wrote a Script to Restart Network Services periodically.

This was done as a Hack to the Slow Internet Connection that I was experiencing.

Here is the Code

interval=$1
a=1

restartNetworking ()
{
while [ $a -ge 0 ]
do
echo 'Restarting the Network again'
/etc/init.d/networking restart

echo "Sleep for $interval"
sleep $interval
done
}

restartNetworking

I run it like this:

sudo bash /home/bijay/sh/restartNetworks.sh 30s

Download Bash Script to restart your Network Services Periodically

PS: I know The Script is not written in the best possible manner, but it’s supposed to be a hack to save my time and hence it doesn’t make sense to spend time to find that best way.

Though it still is worth spending time to post about it LOL..

Related Posts with Thumbnails

Popularity: 2% [?]

PR: 0

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
blog comments powered by Disqus
Olark Livehelp