Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for script to email results of pinging printers 1

Status
Not open for further replies.

Sonk

Technical User
Jun 5, 2001
31
US
We have 300 printers on our rs6000 and lately some of our older (but heavily used) IBM printers have lost the polling signal and need to be reset.

I would love to be able to find a script that will email me (sendmail) when any of these printers cannot be pinged.

Thank you!
 

You can check the exit status of each ping command using the shell variable $?. 0 is a successful ping, non-zero (usually 1) is a failed ping. So you could do

ping XXX.XX.X.XX 5
[ $? != 0 ] && echo "Server XXX.XX.X.XX no reply" or have it mailed to u...

sendhil

 
Thanks--that does work, but I would like to create a script to use in our cron. When I applied your script, I used the IP of one of our suspect printers. It gave me a normal ping response...just kept showing the bytes...but did not stop. Any suggested tweaks for it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top