LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2009, 05:01 AM   #1
sd||
Member
 
Registered: Oct 2009
Distribution: Arch Linux
Posts: 89

Rep: Reputation: 18
how to run a shell script with super user privs when my network get disconnected!!!


i am working on Debian lenny!!

the problem with my wifi network is that it often get disconnected after a while!!

i run this command to reconnect it back!!

Quote:
sudo ifconfig wlan0 up
i want to automate this!!

how can i!! can write a shell script but how to deploy that!!!
 
Old 12-02-2009, 05:14 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You can write a shell script checking the state of the network and/or interface, next if the network is unavailable or the interface is down or combination of both run some command in your script to connect again.

Test the script to see if it works and does what you want/need it to do and then plan it to run like every 10 minutes using cron.

But I believe it's most important to look for the underlying reason why you get disconnected and not write a solution. If the network or interface goes down on a regular basis there must be a reason for that. If you find what causes it maybe you can fix it so there will be no need for a script.

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i change to super user then revert back to ordinary user ,using shell script? wrapster Solaris / OpenSolaris 6 03-18-2009 03:37 AM
Shell Script - Change user & run multiple commands ijf99 Linux - Newbie 1 01-26-2009 06:15 AM
How to run a Gtk application as a user with root privs? werner1975 Linux - Software 24 11-19-2007 07:20 AM
allow sudo for www user to run root shell script cccc *BSD 12 07-23-2005 03:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration