LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 11-08-2011, 04:18 PM   #16
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397

Post 14 makes sense.
Try adding
Code:
set -xv
at the top of the code and see the output.
Also, for Centos/RHEL, try
Code:
service network restart
instead
 
Old 11-09-2011, 02:30 AM   #17
TheOnlyQ
Member
 
Registered: Apr 2011
Posts: 33

Original Poster
Rep: Reputation: 0
Added your suggestions, still doesn't seem to be working.

Script runs every 1minute via cron, output in logs over a 10 minute period ;


ping failed
ping failed
ping failed
ping failed
ping failed
ping failed
ping failed
ping failed
ping failed
ping failed

Set -xv added & I'm monitoring the pings, it just isn't trying to restart the network at all, not sure why.

@chris - yeah I did change the command to adapt to service network restart

Last edited by TheOnlyQ; 11-09-2011 at 02:32 AM.
 
Old 11-09-2011, 08:37 AM   #18
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,552

Rep: Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112
You're running it in the cron? What changes did you make to the script to accommodate that? As its written it can't be run in the cron.
 
1 members found this post helpful.
Old 11-09-2011, 09:12 PM   #19
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Try running it at the terminal for test purposes. The 'set -xv' will show you a lot of detail.
If you were running it in cron, you'd want to collect stdout & stderr in a file eg
Code:
< time setting> /home/myscript.sh >/home/myscript.log 2>&1

Last edited by chrism01; 11-09-2011 at 09:16 PM.
 
Old 11-13-2011, 01:34 PM   #20
TheOnlyQ
Member
 
Registered: Apr 2011
Posts: 33

Original Poster
Rep: Reputation: 0
Alright, big thank you to all the people who posted here.. got my script working and it does the job PERFECTLY!

Thank you!

Last edited by TheOnlyQ; 11-13-2011 at 03:11 PM.
 
  


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
800Mb debian anyone / how to restart net connection without restarting comp? redlinuxxx Debian 9 09-21-2010 08:56 PM
net drops while others in the same network download something or browse the net !! wanas Linux - Networking 9 10-09-2009 07:53 PM
scripting help: how to restart an application that fails to start sometimes? murray_linux Linux - Software 16 06-27-2007 04:13 PM
restart needed for connecting to net. j_hawk Linux - Networking 6 02-19-2007 12:48 PM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 12:24 PM

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

All times are GMT -5. The time now is 04:00 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration