• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

scheduling using cron

 
Ranch Hand
Posts: 94
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Hope I posted the question in the right section of the forum.

In Jenkins we use cron to schedule

there are 6 asterisk . * * * * * * is equal to Minute ,Hour ,Day of month ,Month ,Day of week ,Year .

*/5 * * * *
this implies every 5 minutes.How?
and does /5 belong to first asterisk? if yes,there are only 5 asterisk above. where is 6th asterisk?

and what does following statement mean?

To allow periodically scheduled tasks to produce even load on the system, the 'H' token can be used. For example, people often use '0 0 * * *' for a daily job, but this ends up causing a large spike in midnight. In contrast, doing 'H H * * *' would still execute a job once a day, but the actual time of the day this gets executed will be spread over by Jenkins.


H * * * * *
And what is "H"?

Please clarify me about this.
Thank You
 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please go through this.
It explains use of forward slash (/) in a cron expression.
Regarding number of asterisks, if you are mentioning 5 asterisks, it means job will run every year.
So is a perfectly valid syntax.
It means job will run every day of every month of every year at 20th minute of 2nd hour of the day.
Sorry, I have never used "H", so I am not sure about that.
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is nothing but a GUESS...I've never heard of "Jenkins".

but I would think the "H" is a special flag you use to tell Jenkins "I want this to run at some point, but don't care exactly when. I'll let you decide".

For example, we have many "sites" running on a box. We have a cron job for each site that cleans up old files. There could be 20-40 sites on a box, so there are 20-40 cron jobs. If all those jobs were scheduled by different people, they might all say "1a.m. is a good time to do that, because not much happens then". They then all schedule the job for "00 1 * * *". So, at 1 a.m., disk IO goes through the roof because they all fire at once.

Since it doesn't really matter WHEN the jobs run, it sounds like in Jenkins you could use the "H" flag. So, Jenkins would read ALL the jobs with H's. It finds all of them, figures you want them to run once a day, so it says "Ok, i'll run THIS one at 1a, THAT one at 2a, this OTHER GUY at 3a...etc."
 
Marshal
Posts: 5746
349
IntelliJ IDE Python TypeScript Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What Fred says sounds just about right.

Jenkins is a Continuous Integration tool. it used to be called Hudson. You can configure arbitrary jobs and schedule them to run at specified times. Or you can hook it up to your source control system to be triggered when a chance is committed. People normally use it to compile and run the tests of your project and have it email you if there's a problem, but you can use it for all sorts of other things too. For instance, we use a similar system to build and deploy applications to various environments. It's pretty useful.

I digress a little. Systems such as Jenkins will have a finite number of machines / processes available to run jobs so as Tapas says if you configure all your jobs to run at midnight then they'll all back up and system usage goes wild. The 'H' option is a "Run this once a day, don't care when".
 
please buy this thing and then I get a fat cut of the action:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic