I have a cron job that runs at 1am everyday that creates two files in /tmp, called firstrun and endrun, each containing the time that a script should be run. Once in the morning and once at night. The files only have one line and looks like this:
I need a script that runs in cron that checks these two files, and if the current time is greater than what is seen in each file PLUS 5 minutes, it kicks off another script and exits. The kicker is that it only needs to run twice a day. I figure that it could delete the file once it meets the requirements and if the file isn't there exits. Of course, at 1am, the files will be put back in /tmp by the first cron job.
The idea is to only run the jobs once per day each. Not over and over, everyday. The time in the files changes everyday. Also, I should say that the script that fires off on the first file is different that the script that fires off on the second file.
Is there a simple check, fire, delete, exit script that can be put in cron and ran every 5 minutes? or an easier way to do this? I have tried several methods and have never found a way to automate this successfully.