PDA

View Full Version : Cron Job Question


imanahmadi
07-03-03, 23:33
I have a question about the use of cron job. I understand that it executes a process at a certain schedule, but is there a way to execute a process once there has been a change in a directory or file? If so, how would one do such thing? If not, what can be done to execute a process once a change has been made in a directory or file?

sypher
07-04-03, 07:05
Originally posted by imanahmadi
I have a question about the use of cron job. I understand that it executes a process at a certain schedule, but is there a way to execute a process once there has been a change in a directory or file? If so, how would one do such thing? If not, what can be done to execute a process once a change has been made in a directory or file?

What kind of change are you talking about? If your waiting for a directory or file to change then create a script that creates a parameter file that gets updated when the file is updated. Say 0 means not updated and 1 means it is, when it is set to 1 run the other process from the script.

You can check if the file is updated doing a du -sk on the filename, if this greater then up date the parameter file.

aruneeshsalhotr
07-09-03, 20:01
Hi
A simple way to do the cron job is to run the cron job every minute which internally would call a command which checks the file for any changes.
If this doesnt seem to fit your requirement, you could use trigggers to perform such an operation.
Aruneesh