Linux Cron Jobs Start recurring job at specific time

  • devilwood
  • Silver Member
  • Silver Member
  • User avatar
  • Posts: 436

Post 3+ Months Ago

It seems like all the crontab tuts I've come across greatly simplify the crontab which is good cause that's typically all one needs to know. I'm now in a situation where I'm running a process every 15 minutes and creating a log. So, I added the line to the crontab to run the script, saved it, and away it went. Then, I noticed in my log when it tells me what time the script ran is at H:03 then again at H:18 yet again at H:33 and lastly at H:48. Obviously, the moment I save the crontab started the 15 minute interval on those minutes (03,18,33,48). Is there a way I can get these times to be :00,:15,:30,:45?

Do I have to just watch my clock and save my crontab on the hour??
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Can you post your cron line (just the timing part). With your standard cron you can specify a time, to get an interval you do a little more and that really comes down to when you first started it.

The easiest way to get an on the minute is to run 4 different cron, one for 0, 15, 30 and 45.

You might this for your minute field

Code: [ Select ]
0-59/15


That should tell it to run on the hour and then every 15 minutes after.

My guess is you are doing

Code: [ Select ]
*/15
  • devilwood
  • Silver Member
  • Silver Member
  • User avatar
  • Posts: 436

Post 3+ Months Ago

Yes. You're right. I'm using */15.

Thanks. There's so many write-ups on cron that are basic and I never saw any that covered this. Thank you.
  • xenome
  • Born
  • Born
  • xenome
  • Posts: 1

Post 3+ Months Ago

SpooF wrote:
Can you post your cron line (just the timing part). With your standard cron you can specify a time, to get an interval you do a little more and that really comes down to when you first started it.

The easiest way to get an on the minute is to run 4 different cron, one for 0, 15, 30 and 45.

You might this for your minute field

Code: [ Select ]
0-59/15


That should tell it to run on the hour and then every 15 minutes after.

My guess is you are doing

Code: [ Select ]
*/15



Would you please help me on this ... i wanna know how to set THE STARTING TIME FOR THE REPETITIVE JOB as we do in windows scheduled tasks ... for example i wanna set the Job to run every 10 minutes starting a specific date time and not NOW when crontabbed :? ...

Many Thanks
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

I'm not really sure how to do that off the top of my head besides setting a cron job to alter the cron.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

have you asked your host to set it or provide more information.
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

I think you're looking for something like this:
Code: [ Select ]
echo "*/10 * * * * /path/to/my/script.sh" | crontab | at 00:00

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 23 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.