[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

External Paging Script



Hey all,
 Attached is a paging script I'm using to limit the amount of pages within a
15 minute window to one page per window.

 Script comes with no warranty or support, use at your own will.  I know,
it's kludgey as well.

--Pat

#!/usr/bin/perl

$INTERAL = 900; ## # Of Seconds between Pages
$RCPT = $ENV{'RCPT'};
$RCPTN = "/bb/hms/server/tmp/np-".$RCPT;
$ACKCODE = $ENV{'ACKCODE'};
$BBHOSTSVC = $ENV{'BBHOSTSVC'};
$NOW = `date +%s`;
chomp $NOW;

$mstat = (stat $RCPTN)[9];
$fileage = $NOW-$mstat;


if ( $fileage >= $INTERVAL ) {
        open (PAGER,">$RCPTN");
        system('echo $BBHOSTSVC [$ACKCODE] | mail $RCPT');
        print PAGER " ";
        close (PAGER);
};