9

Run a cronjob only when a file is modified?

view full story
linux-howto

http://www.unix.com – Hello, I am new to cron. I have a cronjob that updates a dataset in a 3rd party application. The contents of this dataset come from a text file, which is updated irregularly. Currently my cronjob runs once every week, to update this dataset (irrespective of whether the file was updated or not). My task is to run the cronjob, if the file was modified say in the last 7 days. I can find if the file was modified using: Code: find /my_dir_name/my_Filename -mtime -7 -type f And my cronjob is: Code: 00 1 * * 5 (myScript > myLogFile) Is there a way to combine these? Thanks (HowTos)