How to run a Cron job for every 5 mins for only 30 mins? - linux

I want to run a Cron job for every 5 mins for 30 mins, starting at 22:30 till 23:00.
To do this I wrote it like this
0 30,0/5 22 ? * * *
If you put this in https://crontab.cronhub.io/
It will say:
At 30 minutes past the hour and every 5 minutes, starting every hour, between 10:00 PM and 10:59 PM
But when I looked at the logs, I see it started the run at 22:00 till 22:55.
Why is this happening? Also, how can I make it work like the way I want it to.

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 a cron job every 45 minute only between 10 am to 10 pm

I need my crontab to execute every 45 minute of hour between 10 am to 10 pm.
currently I trying this
*/45 10-21 * * *
is this right or not?
This would start the first job at 10:45am last one at 9:45pm and jobs started at 45th min of every hour in between.
You can refer here how cron works https://man7.org/linux/man-pages/man5/crontab.5.html

Cron - Scheduling a workflow to run every hour, except 2 hours between 12 AM and 2 AM

I am using cron and I need to schedule my workflow, so that it runs every day hourly, just except 2 hours from 12 AM until 2 AM. Meaning it needs to run daily from 2 AM and kick off every hour, but just when the clock hits 12 AM it should't run for 2 hours. And then starts back at 2 AM to run every hour.
Would appreciate a solution.
This is a CRON job
0 0 2-23 ? * * *
Description: Job will start at second:00, at the minute:00, every hour between 02 am and 23 pm, of every day
I have found this website useful to create CRON job

Cron job every 5 minutes before 30 minutes

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.

Cron job run every N hours (where 24 isn't evenly divisible by N) doesn't work as expected

For example, if I have a cron job that I want to run every 9 hours:
0 */9 * * * my_script
The job is executed at 00:00, 9:00, and 18:00; and then the same hours the next day.
What I want is for the job to execute at 00:00, 9:00, 18:00; then 03:00, 12:00, 21:00 the next day -- a true "every 9 hours".
Is there any way make cron job run EVERY 9 hours?
Specifying */9 means that the job runs every 9 hours starting at 00:00. It starts again at 00:00 every day.
There is no syntax in cron to run a job every 9 hours.
What you can do is run a job every 3 hours, and have the command itself examine the current time and only execute 1 time out of 3. Or it can run every hour and execute one time out of every 9. Don't assume that the current time will be exact; it might run a few seconds after the hour.

Resources