LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-03-2006, 02:46 PM   #1
nl1at
LQ Newbie
 
Registered: Mar 2004
Location: Uitgeest Netherlands
Posts: 26

Rep: Reputation: 15
Newbie No output from shell script


Im very new to shell scripting.
I´ve made a shell script to check my isp link .
Code:
#!/bin/sh
. /etc/dhcpdpc/dhcpcd-eth0.info

if ! ping -qnc 1 $GATEWAY ; then
/usr/sbin/renet
fi
But i dont want the output from the ping cmd.
How can i do just that?
And how do i check eth0 is up?
And i want to check it every 5 minutes , what the best way to do that?

Last edited by nl1at; 04-03-2006 at 03:03 PM.
 
Old 04-03-2006, 03:47 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
For the first part, you can divert ping's standard output to /dev/null with:
Code:
ping -qnc 1 $GATEWAY >/dev/null
For the second part have a look at crontab's man page. From memory, the crontab line will be something like:
Code:
*/5 * * * * /path/to/your/script
 
Old 04-04-2006, 09:33 AM   #3
nl1at
LQ Newbie
 
Registered: Mar 2004
Location: Uitgeest Netherlands
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks Steve.
I did think of cron but forgot about the */5 option .
Thanks alot.
Eddy
 
  


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
Redirecting output of a shell script raj_deep2k1 Linux - General 2 01-20-2006 07:38 AM
How do I make PHP display output from my shell script? farmerjoe Programming 2 04-03-2005 01:15 PM
shell script output redirection goral.j Programming 3 01-27-2005 05:34 AM
Shell Script (adding a prefix to output lines) rheza Programming 3 01-04-2005 01:18 PM
Shell Script for Gzipping with date output Junior41180 Programming 1 10-16-2004 06:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:21 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
Open Source Consulting | Domain Registration