Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to generate the cron expression based on milliseconds. For example: what will be the cron expression for 86400(milliseconds) and how to get the expression..? Please help..

Thanks...

share|improve this question
1  
86400 is the number of seconds in a day. It has nothing to do with milliseconds. – Daniel Beck Mar 6 '12 at 11:06

cron is not intended for high-accuracy timing ! Forget about seconds or even milliseconds precision here. The best you can get is minutes.

cron CAN be and is frequently off by several seconds (due to process start-up, ...).

If you really require that kind of precision, you should build your own daemon (unless I got your question wrong).


If your intend is "just" to convert second/millisecond time to crontab expression. Then:

  • I assume these jobs are daily jobs, that is <second_number> < 84600
  • 1st arg = minutes of the hour = int( (<second_number> % 3600) / 60)
  • 2nd arg = hours of the day = int( (<second_number> / 3600) )
  • 3rd arg = every day of the month = *
  • 4th arg = every month of the year = *
  • 5th arg = every day of the week = *

For more have look at the crontab man page.

share|improve this answer
    
my concern is.. i have a table containing trigger timings for different jobs.. i need to get the cron expression for those triggers from that table.. but that table contains a column which has time in seconds/millisecond(86400).. so cant we get cron expression for the trigger based on particular column containing timings..? – kiran Mar 6 '12 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .