LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-17-2006, 12:50 AM   #1
javaguy78
LQ Newbie
 
Registered: Jun 2006
Distribution: OpenSUSE 10.1
Posts: 1

Rep: Reputation: 0
Question KNetworkManager and Shell Scripts ~ lost in execution.


I am using SUSE 10.1, and my Wireless Network card (a Belkin RT2500, I believe) is running quite well using the NDisWrapper... but every once in a while, it drops connection. I wrote a shell script as root to check for network connectivity, and if it isn't there, the script is supposed to kill all occurances of NetworkManager (since I use KNetworkManager to manage my wlan0). The script follows:

Code:
#!/bin/bash
mytest=$(ping -c 1 192.168.1.1 | grep -c time);
if [ "$mytest" ==  2 ];
then
  date;
  echo "----- System is cool!";
else
  mypid=$(pgrep NetworkManager);
  kill $mypid;
  sleep 2s;
  NetworkManager;
  date;
  echo "----- System Down - Resetting";
fi
Problems (2 total):

Number 1: If it cannot ping the router and there is already a NetworkManager PID (stored in mypid), it successfully kills NetworkManager, but won't successfully restart the process after the 2 second pause.

Number 2: If there isn't already a NetworkManager PID, it successfully starts a process if I run the script from the command line, but will not start the process if launched from the crontab:

Code:
*/5 * * * * /root/KeepConnectionAlive.sh
Can anyone help me find trouble shoot this script? Should I back off from Suse and use something different?
 
  


Reply



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
LXer: Adodb Multiple Test Scripts Remote Command Execution ... LXer Syndicated Linux News 0 01-09-2006 06:01 PM
crond shell execution problems lm317t Linux - General 1 02-22-2005 09:46 AM
Parallel Execution Capable Scripts? irfanhab Programming 5 08-28-2004 06:04 AM
Speeding up Shell Script execution?? funkymunky Programming 8 07-16-2004 08:39 PM
Execution of PERL scripts in Linux which is compiled in WINDOWs environment to_veera Linux - Software 3 06-18-2004 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:50 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