Cron Job With Altering Behavior Depending on Hour - cron

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.

Related

Run cron at a different frequency in specific interval

I have a cron job that runs every 30 minutes, starting 10 minutes past a whole hour:
0+10/30+*+*+*+?
Now, this needs to be changed, so that in a specific time interval, it runs every 15 minutes instead. E.g. at 7.50, 8.05, 8.20 and 8.35. Then every 30 minutes again.
Is this possible with a single cron job and if so, how? Or do I need multiple jobs to accomplish this?
Thank you in advance.
not easy in a single cron, and that is also hard to read.
multiple jobs may work fine and show much clear
// This will start at 1:10am, and every 30minutes run once.
0+10/30+1-23/2+*+*+?
// This will start at 0:10am, and every 15minutes run once.
0+10/15+0-24/2+*+*+?
you may also consider to void the two job running at the same time.
As far as I've understood, this is not possible within a single cron job.
setup cron from morning to evening only points out that three different cron jobs are needed, so I am closing my question.

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

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.

Need Cron expression to trigger job for every 90 minutes in AWS Glue

In AWS glue service there is an option to trigger job by custom CRON expression. Before i used this (0/2 * * ? *) cron expression to trigger job for every 2 hours.
Now I need to change the cron expression to trigger every 90 minutes, i.e for every 1 and a half hour. I tried with many cron expressions but that did not triggered for every 90 minutes. Even if i give for 90 minutes, it trigged for every 1 hour.
Can anyone help me out by providing the correct cron expression to trigger job for every 90 minutes ?
You can use the following pattern which was based on Bill Weiss' answer on Server Fault. It was modified to comply with the unique syntax AWS uses (reference here):
0 0-21/3 * * ? *
30 1-22/3 * * ? *
You'll have to define two separate Glue Triggers to accomplish this, each with the same job settings.
If curious, the syntax reads:
Run every 0th minute for every third hour for 0-21 hours
Run every 30th minute for every third hour for 1-22 hours

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.

Linux: Start a cron job inside another cron job

I am dealing with a workflow where I need to start three processes. I have the first process which is to be scheduled at the beginning of every hour and the rest two at 45th minute of every hour and the 52nd minute of every hour.
But Instead of making the client schedule two different jobs on their server what I would rather want is to have just one job configured to run in the beginning of every hour which does a bunch of stuff and then starts these cron jobs at their respective times. i.e. 45th minute and 52nd minute of the hour.
Is there any way to do this.
I don't have any experience with shell scripting and always schedule cron jobs manually on cron-tab.
Thanks!

Resources