Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Checks if the Arq Backup release note page has changed and sends a notification. Run every hour via cron.
#!/usr/bin/perl
require WebService::Prowl;
my $oldvalue = "";
my $md5 = "";
$result = `curl -s "https://www.arqbackup.com/download/arq5_release_notes.html" | md5sum`;
($md5, $ignore) = split(/\s/, $result);
if ( $? == -1 ) {
print "command failed: $!\n";
} else {
chop($md5);
if (open F, "/tmp/arq.txt") {
$old_md5 = <F>;
close F;
print "old md5: $old_md5\n";
}
system('touch /tmp/arq.txt');
if (($md5 ne "") && !($md5 eq $old_md5)) {
print "md5: $md5\n";
open F, ">/tmp/arq.txt";
print F $md5;
close F;
printf "command exited with value %d", $? >> 8;
send_notification('Arq5', '', "Arq5 has released a new version!");
}
}
######################################################################################################
sub send_notification($$$) {
my ($app, $event, $message) = @_;
if ($event eq "") {
$event = ' ';
}
my $ws = WebService::Prowl->new(apikey => 'notmyrealkeydonteventhinkofusingit');
$ws->verify || die $ws->error();
$ws->add(application => "$app",
event => "$event",
description => "$message",
url => "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment