Will */5 hours in a Cron job be done at 1pm the next day? - cron

We need a Cron job that runs every 5 hours and that takes a little longer than 4 hours to complete,
If it's scheduled in a Cron job as */5 for the hours part will it run at 1pm the second day?
Ie. Will the first day be 0,5,10,15,20 and then 1,6,11,21, (and so forth...)?

No, it will not.
Assuming the minute part is fixed (which makes the full cron expression into 0 */5 * * *), the cron job will always be triggered at 0th, 5th, 10th, 15th, and 20th hours every day.
In addition to that, the next cron job will be triggered regardless of whether the previous cron job has already been completed or not. For example, if the cron job at 5th hour takes 7 hours to complete, the cron job at 10th hour will still be triggered on time.

Related

Cron Job With Altering Behavior Depending on Hour

Is it possible to execute a Cron job such that between certain hours, it executes every 30 minutes, but other hours, only every 1 hour?
I was unable to figure this out using my basic Cron abilities.

cron expression for every 30 minutes from 9am to 9pm and once at 3am midnight

Can you please guide me in writing a cron expression for every 30 minutes from 9am to 9pm and once at 3am midnight. Is it possible in one expression? I can do easily for every 30 mins 9am to 9pm as "*/30 9-21 * * *" but how to add 3am to this. Thanks.
Unluckily it is not possible to create it in a single cron. You will have to create 2 separate crons one which does the 30 minutes 9-21 like you have it and one to run it once at 3am.

Airflow terminates current run, and starts new run, every day at midnight, despite my CRON schedule

I have an Airflow job that I wish to run every 130 minutes. I have set the cron schedule like this: "*/130 * * * *".
This schedule functions normally, until the clock hits midnight. Each day at midnight, if a job is currently underway, Airflow will terminate the job and start a new job. I do NOT want this behavior. Thanks in advance for your advice!

Cron Schedule for a job that runs every minute from 8 am to 7:30 pm

I can't figure out how to create a job that ends at a specific hour and minute
If you break your cronjob into two, it would look like:
* 8-19 * * * command
0-30/1 19 * * * command
first line runs every minute from 8-19, and second line every minute from 19-19:30.
Cron triggers are not quite suitable for these types of schedules. If you do not insist on using a Cron trigger, I recommend that you check the Daily Time Interval trigger that is designed for use-cases such as yours. I am attaching a screenshot of a Daily Time Interval Trigger configuration for your use-case.

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