Cron Job: Start it Only once on specified time
I want cron job to start the script on a specified time, i.e 9:00am, and it started only once. Because this script runs forever as long as there is no system boot up. I just want to start this script on the OS only once, if it is not already started, on a specified time. Script will be runnig forever without terminating.
Any idea how I can do this in cron? |
Submit an at job instead.
Code:
man at |
You could use a lock file. When the cron script starts it checks to see if the lock file exists. If the lock file exists the cron scripts exits. If the lock file does not exist then the script creates the lock file and continues to run.
Then you need a second script which runs on each boot and deletes the lock file. ------------------ Steve Stites |
All times are GMT -5. The time now is 02:57 PM. |