#!/usr/bin/perl -w # Author: ryu@mundivia.es # # It's designed for X-Chat # # This script is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This script is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You can read the GNU General Public License at http://www.gnu.org my $VERSION="0.0.1"; my $conn=1; IRC::register("RePon",$VERSION,"",""); IRC::add_timeout_handler(2000, repon); IRC::print("RePon will check your pppd!"); sub repon { my $process=`/sbin/ifconfig |grep ppp`; if ($process and (not $conn)) { IRC::print("PPP connection restarted! Reconnecting\n"); IRC::command("/reconnect"); $conn=1; }elsif ((not $process) and $conn) { IRC::print("PPP connection closed, waiting for new connection...\n"); $conn=0; } IRC::add_timeout_handler(2000, repon); }