LinuxQuestions.org
Register a domain and help support LQ
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 02-18-2008, 03:15 PM   #1
xtraya
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
shell script (continuous pinging and actions when host is up)


Hi guys, i have small problem.

I need help for one small shell script. here are actions for script:

1. script must ping one host (192.168.3.111)
2. if 20 pings of host are DOWN (no reply) , script waits for new UP state.
3. when host became ACTIVE and UP, waits for 20 seconds end executes some other script (some videolan reload script)
4. everything goes again and againg ... continuosly waiting for down , up and executing...

thanks
 
Old 02-18-2008, 04:24 PM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
A quick google yielded the following:

http://bash.cyberciti.biz/monitoring...mmand.bash.php

Implement a check for the host coming back up, add an entry to cron and you're done.
 
Old 02-19-2008, 02:28 AM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,751

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
You might want to look at putting some of your commands into an ip-up script in /etc/ppp. The ip-up script, if present, is automatically run when a connection is established. you can also use ip-down scripts which will run when a connection goes down.
 
Old 02-19-2008, 06:59 PM   #4
xtraya
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Original Poster
Rep: Reputation: 0
hm, i will check this script but it is not exactly what i need
 
Old 02-19-2008, 07:11 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,118
Blog Entries: 54

Rep: Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787Reputation: 2787
Quote:
Originally Posted by xtraya View Post
hm, i will check this script but it is not exactly what i need
You're free to change that script to whatever you need it to do.
 
  


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
writing a shell script for scheduled pinging laucian Linux - Newbie 12 11-08-2007 05:48 AM
Logging into a remote host automatically through shell script patil_reddy Red Hat 1 06-13-2006 06:23 AM
continuous running a pl script sikkalgopal Linux - Software 6 02-19-2005 05:05 AM
i m getting the error unknown host while im pinging with the host name gunjan thakkar Linux - General 2 12-14-2004 01:19 PM
'Unreachable Host' when pinging with RedHat 7.1. Help! SadTechie Linux - Networking 1 12-03-2001 04:26 PM


All times are GMT -5. The time now is 10:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration