Randy Kramer wrote:
> daRcmaTTeR wrote:
>
>>What if you just did something like this.
>>
>> 1) ping ISP...
>> a) if icmp echo request == 'yes'
>> then
>> do the mail thing
>> else
>> run "ifup" command kick mailque
>> fi
>>
>>what-cha think?
>
>
> daRcmaTTeR,
>
> Thanks very much -- it's a good start if not more!
>
> I guess I'll find out for sure soon ;-) , but is that "if icmp echo
> request == 'yes'" pretty close to the right syntax? (I assume it's
> checking for success of the ping.) Hmm, I looked up man icmp and man
> echo -- looks like I'll have to dig a little deeper or do an experiment
> or two.
>
> (Just for the record, I don't need (and can't use) the ifup command
> (effectively) as the dial up modem is on another box (running under
> dos). The ping should "kick" the modem (except that, occasionally, the
> modem hangs up and "locks up" so it won't redial). I'll probably
> arrange the script to ping, check for success, on success kick the
> mailqueue, on failure wait, then retry the ping.)
>
> So ("thinking on paper"), something like:
>
> maxtries = 3 (??)
> count = 0
> start: ping ISP (with parameters to limit to say 4 pings instead of
> continuous)
> count = count + 1
> if icmp echo request == 'yes'
> then
> fetchmail
> sendmail -q
> else
> if count <= maxtries (wow, do I forget valid syntax ;-) )
> then
> wait 30 (??) (give the modem a chance to connect)
> goto start
> else
> issue "Internet connection lost, could not restart"
> message (somewhere)
> fi
> fi
>
> I'll need to brush up on bash syntax and so forth, and if I'm clever I
> might get rid of the goto.
>
> regards,
> Randy Kramer
Randy,
it is written: "thou shalt NOT use a GOTO...ever!" ;) The force fed us
that in assembler and COBOL classes till I thought it was gonna come
outa my ears.
--
daRmaTTeR
Reg. Linux User #186492
"Stupidity has no moral high ground...it can't see that high!"
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com