no need for crontab. just save and run this perl script:
#!/usr/bin/perl -w
use strict;
my $host = "my_isp_host";
my $email_addy = "[EMAIL PROTECTED]";
my $ping = "/bin/ping";
my $sleep = "/bin/sleep";
my $mail = "/bin/mail";
my $echo = "/bin/echo";
while(1){
`$ping $host -c 2 -w 2`; #ping with 2 sec timeout
if($?) {
`$echo \"\" | $mail -s \"No ping from $host\" $email_addy`;
}
`$sleep 300`; #sleep for 5 mins
}
rowel
Jun Tanamal said:
>
>
> Gabriel L. Briones III wrote:
>
>>you can make a script that will check the connections and
>>place it at your cron job
>>
>>here's a sample script for you to use as a referrence
>>
>>
>>#!/bin/sh
>>
>>ping -c 2 <ip-address-here>
>>
>>if [ ! "$?" = 0 ]; then
>> <mail command here>
>> exit 1
>>fi
>>
>>
> 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 :(
--
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