-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> >
> >#!/bin/sh
> >
> >ping -c 2 <ip-address-here>

this should be "ping -c 2 <ip-address-here> > /dev/null"
this is to prevent the ping command to output anything on
the screen 

> >
> >if [ ! "$?" = 0 ]; then
> >  <mail command here>
> >   exit 1
> >fi


the $? value will hold the return value of the last command
that is executed, in this case the 'ping' command

the close and open bracket '[]' is short for the test
command

so when you say

  if [ ! "$?" = 0 ]

you are also saying that if value of $?
is not equal to zero then do something else


you can take this as a sample mail command

echo "Error in connection" | mail -s "<subject-here>" 
<recipient>


> yes, me thinks can do it in crontab. By the way I need
> some brief explanation on what are those characters for
> inside the bracket...poor me :(  
> and what syntax is for the mail command? (I'm confused in 
> #man mail)
> sorry for this...but I want to learn :)
> I appreciate the help..
> 
> -Jun
> 



- -- 
Gabriel L. Briones III <[EMAIL PROTECTED]>
Network Administrator, OmniSoft Solution's Inc.
Linux User # 273591
09178264717
- -----------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/FPriDGdUl1iiRBERApI/AKCRTGI/1LBWU6ZhTVGX/Ju6eBOGzwCfXU0t
NJbpT1ecM8j90rSpX888L3Q=
=9k77
-----END PGP SIGNATURE-----
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to