Created
September 5, 2014 11:08
-
-
Save wesyoung/6058b7b1d23f62673aad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# modified the feed_lock.pl script to check the file | |
# /tmp/cif_crontool.lock.daily and see it it's older than 23 hours | |
use strict; | |
use File::stat; | |
use MIME::Lite; | |
my $file = '/tmp/cif_crontool.lock.daily'; | |
# integer representing seconds | |
# 24 hours = 86400s | |
my $time_difference = 86400; | |
#mailto | |
my $sysadmin = 'root@localhost'; | |
if (-e $file) { | |
my $file_time = stat($file)->mtime; | |
my $current_time = time; | |
if (($current_time - $file_time) > $time_difference) { | |
my $msg = "The file $file is older than $time_difference seconds.\n"; | |
my $m = MIME::Lite->new( | |
To => $sysadmin, | |
Subject => 'Warning: cif_crontool.lock.daily', | |
Data => $msg, | |
); | |
$m->send(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment