Howdy peoples.

I want to write a shell (or perl) script to test if ppp0 is up or not, and
if it isn't to restart ppp0

so for instance:

if (ppp0 ne "up")# This is the bit I am unsure of...
{
ifdown ppp0;
ifup ppp0;
}
else {
exit;
}

I get disconnected once a month by my ISP (I have a permanent dialup
connection) when they restart their router.

So I have two questions.. concerning the snippit of perl above, how do I
test for the condition of ppp0 and test for the result so I can have a
"true" or "false" result and have the if statement proceed accordingly.

I would rather do this with a shell script I can run from crontab....  so in
that case, I'd use the if/fi if statement, but the process is much the same.

The other problem I have, is that when I get disconnected from their end, I
get something weird happening to the modem..
ATZ should rest it, but it doesn't appear to. (its a hanes compatable 56K
KTX Modem (based on a Rockwell chipset)
Does anyone know of a way to reset the modem without having to manually turn
it on and off?  (The box is not local so I can't do that..)


Also, I want to tinker with my firewall, I have a nimda/code red bocker
script that adds offending hosts to my ipchains or tables rules, and keeps a
record of the IP's blocked so it doesn't keep adding them.. I want to set it
up so that if the firewall is restarted (and the rules wiped as a result)
the blocked file (which is the old list of blocked IP's, is wiped,
rm /var/tmp/blocked and then recreated, touch /var/tmp/blocked  but I need a
way to test if the IPs in the old blocked file are no longer in the ipchains
rules.. (if they are not, the blocked file should get wiped and start again.
if they are, nothing need be done.) any tips anyone???

Any tips would be much appreciated.

kindest regards

Frank


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to