Chase
Chase

Reputation: 9362

How to delay a minutely cron for an hour

I have a cron that needs to run every minute until a certain event happens then i need it to stop running until the next hour. I have looked around and all i can seem to find is how to run crons on different intervals not how to disable it until the next hour starts then re-enable it.

Any help or suggestions to a solution would be great.

Upvotes: 0

Views: 455

Answers (1)

John3136
John3136

Reputation: 29266

Cron runs programs periodically: that's all it does. It doesn't have facilities to do things "optionally". If you want to do something clever you need to handle it on your side. e.g.:

  • Write the time into a file when your event occurs and read the file at the start of your "job" to see if the job should run or not.

Upvotes: 1

Related Questions