[ale] monitoring a web page

Christopher Fowler cfowler at outpostsentinel.com
Wed Mar 22 12:32:59 EST 2006


Crude
#!/usr/bin/perl


sub get_md5sum {
        my $file = shift;
        my $md5 = undef;
        open OUT, "/usr/bin/md5sum $file 2>&1 |";
        while(<OUT>) {
                next unless m/^(.+?)\s$file$/;
                $md5 = $1;
        }
        close OUT;

        return $md5;
}

my $md5 = get_md5sum($ARGV[0]);
my $md52 = get_md5sum($ARGV[0]);
print "md5 = $md5\n";
print "md52 = $md52\n";

You just need to store the previous sum in a file and do this

if($old -ne $new) {
 fire_alarms();
}


On Wed, 2006-03-22 at 12:17 -0500, Paul Cartwright wrote:
> On Wed March 22 2006 12:00 pm, Christopher Fowler wrote:
> > Just use md5sum
> 
> as opposed to diff?
> I've used diff before, but I'm really not even ever familiar with md5, 
> md5sum..
> 
> I got it to work with diff, so I think I'll stop, before i spend the 
> entire day on this. I've gotta practice training my dog, befoe she 
> takes me to obedience class tonight:)
> she=yellow lab puppy from pound..
> 




More information about the Ale mailing list