Cron job every 5 minutes before 30 minutes - cron

I am trying to create a cron job that fires every 5 minutes before 30, for example:
10:25,
10:55,
11:25,
11:55 etc. I tried */25,55 * * * * but this also sends messages at 10:50 and I'm not sure why, what would be the correct way to do this?

You're looking for the following, which is simply "at minute 25 and minute 55":
25,55 * * * *
In your original attempt, the expression */25 means "every 25th minute". As such, it would execute at 25 minutes after the hour, and then 25 minutes later.. or 50 minutes after the hour.

Related

Cronjob to run after every 30 minutes from a specific time

If my cron job runs first at suppose 9:15. Then how do I make it run after every 30 minutes from then at 9:45 then 10:15 and so on?
How about:
15,45 9-23 * * *
This should give you “At minute 15 and 45 past every hour from 9 through 23.” (according to: https://crontab.guru/#15,45_9-23_*_*_*)

Run Cron Job every 5 minutes for 10 seconds

I have a script that I want to run every 5 minutes for 10 seconds.
*/5 * * * * /root/XXX/cronjobs/add-prod.sh
It seems logical to have another cron job that would run every 5 minutes and 10 seconds
that would turn off the 1st cron job.
Something like this:
[FORMULA HERE] /root/XXX/cronjobs/rem-prod.sh
How can we set a formula for "every 5 minutes and 10 seconds" ?
You can do this via timeout. It will kill the process after 10 seconds. It would be better than killing the process externally. Otherwise, jakob22's answer is the best one.
*/5 * * * * /usr/bin/timeout 10 /root/XXX/cronjobs/add-prod.sh
Edit: This is already featured in a comment.

Crontab except specific hours

I would like to run Crontab every 30 minutes except from 12 AM - 6 AM EST
The following is to set it every 30 minutes but i don't know how to except the mentioned hours.
*/30 * * * *
Thanks in advance.
I believe you want this rule:
0 0,30 6/1 ? * * *
This runs at 0 minutes and 30 minutes past the hour, and every hour after the 6th hour.
This assumes that your system timezone is in an ET timezone like America/New_York

Node schedule run every minute within specific range of hours

I might be overlooking over already-asked-question, but I have not found it yet. Basically, did I do it right in order to execute job for every minute within 9 AM to 6 PM?
schedule.scheduleJob("*/1 9-18 * * *", function Job())
The cron expression should be 0 * 9-18 ? * * *
It reads 0 seconds, every minute, from 9 to 18 every day, every month, every year.
Use cron expression builder for convenience - something like this:
https://www.freeformatter.com/cron-expression-generator-quartz.html

Crontab syntax for non-aligned hourly range?

If I want to schedule a job to occur every five minutes between 9 until 11 pm I can use the following cron trigger:
0/5 21-22 * * *
(or something like 5,10,15,20,25,30,35,40,45,50,55 21-22 * * * for finer control over the minutes if needed).
Is there a way to specify "every five minutes from 9:30 until 11:30"? The trickiness revolves around having e.g. 5 in the minutes field yet skipping it if the hour is 21, and I'm not immediately aware of any way to achieve that.
A simple, workaround would be to add more scheduled jobs in cron...
i.e.
30,35,40,45,50,55 21 * * * /job_to_run
*/5 22 /job_to_run
5,10,15,20,25,30 23 * * * /job_to_run
p.s. Cron usually has the following order:
Minutes Hour DayOfMonth Month DayOfWeek Command

Resources