# USAGE: touchedCheck filename [minutes] # # Exit Value: 0 if file was touched; 1 if not touched. # # Will print info about the file iff it changed in the last N minutes. # Otherwise prints nothing. # # Intended for crontab use, such as: # 0 * * * * touchedCheck /tmp/some_file.txt 60 # /usr/bin/perl -e '$f=shift;$N=shift||60; printf("%s was changed %d minutes ago.\n%s", $f, $x/60.0, `/bin/ls -lart $f`) && exit(0) if ($x = (time - (stat($f))[9])) <= 60*$N; exit(1)' $1 $2