[ale] file modification time via shell script

Chuck Huber chuck at cehuber.org
Fri Aug 3 19:34:50 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> Message: 4
> Date: Fri, 03 Aug 2007 15:24:54 -0400
> From: Jim Popovitch <yahoo at jimpop.com>
> Subject: [ale] file modification time via shell script
> 
> Here's what I am trying to do however:  I need to run a script (via
> cron) that first determines if a log file changed since the last time
> the script ran before it does further processing.  Ideas?

Jim,

You can touch a marker file when the cron job finishes to represent the
last time the log file was checked.   Before that, you can use the
- -newer option on find to see if your log file is newer than your marker.

Perhaps something like...

[ -n "`find ${LOGFILE} -newer marker`" ] && echo "${LOGFILE} is newer"
touch marker

- - or -

if [ -n "`find ${LOGFILE} -newer marker`" ]
then
    echo "${LOGFILE} is newer than marker"
    ...
fi
touch marker


Enjoy,
    - Chuck

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGs7uaiR3HaLbYCa4RAn4HAJ0SNPXe89vYBiFLUFlbNuW32//mrgCggoO4
jBggiMvpyyAWMwaRqUgtv3w=
=t/IJ
-----END PGP SIGNATURE-----



More information about the Ale mailing list