Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Trigger Jenkins Job using “Build periodically” and “Poll SCM”

Method 1 – AT CERTAIN TIME AKA Build periodically

Method 2 – AT CERTAIN TIME BUT Build only when there is Code changes AKA Poll SCM

cron-jobs-in-jenkins

Setting up the cron jobs in Jenkins using “Build periodically” – scheduling the jenins Job

Examples –
To schedule your build every 5 minutes, this will do the job : */5 * * * * OR H/5 * * * *

To the job every 5min past every hour(5th Minute of every Hour) 5 * * * *

To schedule your build every day at 8h00, this will do the job : 0 8 * * *

To schedule your build for 4, 6, 8, and 10 o’clock PM every day – 0 16,18,20,22 * * *

To schedule your build at 6:00PM and 1 AM every day – 0 1,18 * * *

To schedule your build start daily at morning – 03 09 * * 1-5

To schedule your build start daily at lunchtime – 00 12 * * 1-5

To schedule your build start daily in the afternoon – 00 14 * * 1-5

To schedule your build start daily in the late afternoon – 00 16 * * 1-5

To schedule your build start at midnight – 59 23 * * 1-5 OR @midnight

To run a job on 9.30p.m. (at night) on 3rd of May then I ll write or 21.30 on 3/5/2011 – 21 30 3 5 *

Every fifteen minutes (perhaps at :07, :22, :37, :52) 0 – H/15 * * * *

Every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24) – H(0-29)/10 * * * *

Once every two hours every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM) – H 9-16/2 * * 1-5

Once a day on the 1st and 15th of every month except December – H H 1,15 1-11 *

CRON expression

A CRON expression is a string comprising five or six fields separated by white space that represents a set of times, normally as a schedule to execute some routine.

Format

Field name

Mandatory?

Allowed values

Allowed special characters

Remarks

Minutes Yes 0-59 * / , –
Hours Yes 0-23 * / , –
Day of month Yes 1-31 * / , – ? L W
Month Yes 1-12 or JAN-DEC * / , –
Day of week Yes 0-6 or SUN-SAT * / , – ? L #
Year No 1970–2099 * / , – This field is not supported in standard/default implementations.

In some uses of the CRON format there is also a seconds field at the beginning of the pattern. In that case, the CRON expression is a string comprising 6 or 7 fields.

Special characters

Support for each special character depends on specific distributions and versions of cron
Asterisk ( * )
The asterisk indicates that the cron expression matches for all values of the field. E.g., using an asterisk in the 4th field (month) indicates every month.
Slash ( / )
Slashes describe increments of ranges. For example 3-59/15 in the 1st field (minutes) indicate the third minute of the hour and every 15 minutes thereafter. The form “*/…” is equivalent to the form “first-last/…”, that is, an increment over the largest possible range of the field.
Comma ( , )
Commas are used to separate items of a list. For example, using “MON,WED,FRI” in the 5th field (day of week) means Mondays, Wednesdays and Fridays.
Hyphen ( – )
Hyphens define ranges. For example, 2000-2010 indicates every year between 2000 and 2010 AD, inclusive.
Percent ( % )
Percent-signs (%) in the command, unless escaped with backslash (\), are changed into newline characters, and all data after the first % are sent to the command as standard input.[7]

Non-Standard Characters

The following are non-standard characters and exist only in some cron implementations, such as Quartz java scheduler.
L – ‘L’ stands for “last”. When used in the day-of-week field, it allows you to specify constructs such as “the last Friday” (“5L”) of a given month. In the day-of-month field, it specifies the last day of the month.
W – The ‘W’ character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify “15W” as the value for the day-of-month field, the meaning is: “the nearest weekday to the 15th of the month.” So, if the 15th is a Saturday, the trigger fires on Friday the 14th. If the 15th is a Sunday, the trigger fires on Monday the 16th. If the 15th is a Tuesday, then it fires on Tuesday the 15th. However if you specify “1W” as the value for day-of-month, and the 1st is a Saturday, the trigger fires on Monday the 3rd, as it does not ‘jump’ over the boundary of a month’s days. The ‘W’ character can be specified only when the day-of-month is a single day, not a range or list of days.
Hash ( # )
‘#’ is allowed for the day-of-week field, and must be followed by a number between one and five. It allows you to specify constructs such as “the second Friday” of a given month.[8]
Question mark ( ? )
In some implementations, used instead of ‘*’ for leaving either day-of-month or day-of-week blank. Other cron implementations substitute “?” with the start-up time of the cron daemon, so that ? ? * * * * would be updated to 25 8 * * * * if cron started-up on 8:25am, and would run at time every day until restarted again.

In addition, @yearly, @annually, @monthly, @weekly, @daily, @midnight, and @hourly are supported as convenient aliases. These use the hash system for automatic balancing. For example, @hourly is the same as H * * * * and could mean at any time during the hour. @midnight actually means some time between 12:00 AM and 2:59 AM.

Reference:
https://en.wikipedia.org/wiki/Cron#CRON_expression

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

What is Jenkins and use cases of Jenkins?

What is Jenkins? Jenkins is an open-source automation server widely used for building, testing, and deploying software projects. It provides a platform for continuous integration and continuous…

Read More

Jenkins Tutorials: Installing Jenkins on Tomcat

We are going to discuss Installing Jenkins today. We will be focusing on installing it on Tomcat server as a servlet, and tomcat will act as a…

Read More

Jenkins Tutorials: Install Jenkins as Docker Container

In the Previous Post we Learned How to install Jenkins as Servlet on Tomcat server. In this post we will try even simple and easy way to…

Read More

Top Jenkins interview questions and answers

1. What is Jenkins? Jenkins is an open-source automation server that helps automate various aspects of software development, such as building, testing, and deploying code. It allows…

Read More

How to Implement GitOps Using Jenkins?

Hello there, fellow tech enthusiasts! In this blog post, we are going to delve into the world of GitOps and learn how to implement it using Jenkins….

Read More

Jenkins Tutorial: Install Jenkins on Ubuntu

In this tutorial we are going to install Jenkins on Ubuntu operating system. Ubuntu is another debian based operating system – open sourced and highly loved by…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
vamsi
vamsi
2 years ago

Hi,
I am using Poll SCM for my pipelines, I have configured the time for POLL SCM
(H/5 * * * *) it needs to run every 5 mins, but sometimes it’s not working.

What’s the reason, when I check my commit list commits are there but it’s not deployed through the poll SCM every time I need to run it manually

1
0
Would love your thoughts, please comment.x
()
x