newbie script help: script to check file mod date
am 07.01.2008 20:03:24 von leegordHi - I need a simple bash script to check that a certain file is being
uploaded to a linux box on schedule.
I assume the simplest way is to use the file modifcation date. The
file is supposed to be uploaded twice a day, at 9:30am and 1:00pm.
It'll vary in size, so the *exact* mod date won't be the same day to
day (upload time will vary), but i should be able to run a script at
say 9:45am and 1:15pm checking if the file has been modified in the
last 15 or 30 minutes, or something like that.
So i'm thinking something that will:
a) ssh into a server
b) navigate to a specific path
c) check the file modification date on a file
d) compare it to the system time
e) if the difference is greater than X (say 30 minutes) then report
failure, i.e. we have an old file on the server
or if the difference is less than X, report success, i.e. that the
file was recently modified.
I'm enough of a newbie that it'll take me forever to figure out what's
probably a two-second script for someone who knows what they're
doing. Thanks for any help!
- Lee