Skip to content

Instantly share code, notes, and snippets.

@waltman
Created September 6, 2019 18:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waltman/51bba29f97499617af0f14f81107bdfb to your computer and use it in GitHub Desktop.
Save waltman/51bba29f97499617af0f14f81107bdfb to your computer and use it in GitHub Desktop.
Script to check list of websites and report if any have changed
#!/usr/local/bin/perl -w
# $Id: watch-http,v 1.3 2007/03/26 11:58:59 waltman Exp $
use strict;
use LWP::Simple;
my $dir = "$ENV{HOME}/.watch-http";
chdir $dir
or die "Can't chdir to $dir: $!\n";
open CONFIG, "config"
or die "Can't open $dir/config: $!\n";
while (<CONFIG>) {
chomp;
next if /^#/; # ignore comments
my ($file, $url) = split /\s+/;
my $rc = mirror($url, $file);
if ($rc == RC_OK) {
print "$file ($url) has changed\n";
system "svn diff $file";
} elsif ($rc != RC_NOT_MODIFIED) {
printf "unexpected response code of %d (%s) checking %s\n", $rc, status_message($rc), $url;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment