Evaluate cron expression
Posted
by
Jake A. Smith
on Server Fault
See other posts from Server Fault
or by Jake A. Smith
Published on 2012-11-07T21:15:16Z
Indexed on
2012/11/07
23:02 UTC
Read the original article
Hit count: 277
Is there a command line tool that will simply evaluate a cron expression and return a bool response if it is supposed to be running right now? I'm looking for something I can use as a utility in another bash script. Something like so:
run_script=$(/tools/evaluate-cron-expression "02 4 * * *")
if [ "$run_script" -eq "1" ] # etc etc
I know, I know, I could just setup a real cron job, but I'm playing with the idea of wrapping all of my scheduled scripts inside of another script.
© Server Fault or respective owner