Restart Ubuntu's Wireless Network Driver (script)

I have admitted on more than one occasion that I am a Windows fan; yes, even after using Vista! But when I got my new laptop, on which I installed Vista Business on my own, I tried to push myself into using Ubuntu; I'll leave blogging about that experience for some other post (on my RNFs). That was a long time ago (2 months to be precise) and this post is about something else.

I encountered too many network disconnections on Ubuntu. I noticed that the wireless' indicator on my laptop would just go away after using Ubuntu for a while. The only work-around to start the connection I had was to restart the OS! As I was very committed to using Ubuntu at any cost, I dug up the internet and found some clues. A little while later I developed this script.

What this script does is it uses the utility that is installed with the Intel (restricted) wireless driver, to check if the driver is still running,; if it is not, then it starts it, and if it is already tunning, it will kill and restart it. Worked like a magic for me for the week that I used Ubuntu after this.


$ cat restart_network_driver.sh

#!/bin/sh
# This code is in public domain, under GPL 2.0 license
if ipw3945d-2.6.22-14-generic --isrunning; then
echo killing \
&& ipw3945d-2.6.22-14-generic --kill \
&& echo restarting \
&& ipw3945d-2.6.22-14-generic --quiet \
&& ipw3945d-2.6.22-14-generic --isrunning; \
else
echo starting \
&& ipw3945d-2.6.22-14-generic --quiet \
&& ipw3945d-2.6.22-14-generic --isrunning;
fi


Here's what I was using:
OS: Ubuntu 7.04 (Gutsy Gibbon)
Laptop: Thinkpad R61i
Wireless: Intel ipw3945d (restricted) driver

and here's how to use it:

sudo ./restart_network_driver.sh


PS: I am posting it now because I am going to give Linux another shot, this time with Hardy heron; and wanted some place to save this script before I wipe out that partition.

No comments:

Post a Comment