I need a regex that extracts ID from below pattern.. matches pattern.. [any string - cron

I need cron expression For every 90 seconds i.e. to run after every 1.5minutes
I tries * * * ? * * sleep 90; but it says Illegal character for this position: 'SLE'

It depends on the context you're running the job in, but the error is pretty clear: the cron config arguments aren't set up correctly.
From the first link below, these are some examples:
# backup using the rsbu program to the internal 4TB HDD and then 4TB external
01 01 * * * /usr/local/bin/rsbu -vbd1 ; /usr/local/bin/rsbu -vbd2
# Set the hardware clock to keep it in sync with the more accurate system clock
03 05 * * * /sbin/hwclock --systohc
# Perform monthly updates on the first of the month
# 25 04 1 * * /usr/bin/dnf -y update
There is an immense amount of documentation and how-to's online for cron. Here are some I found:
https://opensource.com/article/17/11/how-use-cron-linux
https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm
There are also free web tools that can help you come up with the perfect configuration:
https://www.freeformatter.com/cron-expression-generator-quartz.html
https://crontab.cronhub.io/
This is just a small sample from a quick google for cron or how to use cron.

If you are using Quartz scheduler, probably the easiest would be to use two separate cron expressions:
0 0/3 * * * ?
and
30 1/3 * * * ?
The first expression fires every 3 minutes:
00:00:00
00:03:00
00:06:00
00:09:00
...
The second expression also fires every 3 minutes, but with a 1 minute 30 second offset:
00:01:30
00:04:30
00:07:30
...
If you combine the execution times of both, you get 90 second intervals:
00:00:00
00:01:30
00:03:00
00:04:30
00:06:00
00:07:30
00:09:00

Related

Azure Web jobs run multiple times on the provided cron pattern

I have this CRON pattern for my web jobs 0 0/12 20 * * * and it's running every 12 hours starting 8PM. now the problem is that in azure the service run for almost 5 times until 9PM. is there a way that it should only run once?
Your cron expression means it starts from 8pm and every runs 12 minutes. Cause the azure timer binding document couldn't be open for now, you could refer to this wiki: TimerTrigger.
There are six fields {second} {minute} {hour} {day} {month} {day of the week} to schedule.
So in your situation if you want to run every 12 hours starting 8PM. Yo could try this cron: 0 0 20/12 * * * or with this one 0 0 8,20 * * *. One is start from 8pm and every 12 hours and one is run at the specified time.

How to write cron expression?

In mule, I need to poll once in 48 hours.
I wrote the cron expression 0 0 1/48 ? * * but it is running twice in 48 hours, i.e, once in 24 hours.
Can anybody suggest exact expression?
You can also make use of cron maker.
http://www.cronmaker.com/
You can use 0 0 0 1/2 * ? * to poll once every two days at 12 AM. The 3rd value from right can be used to specify that at what hour you want to poll once every two days.
One thing I can notice in the cron expression you are using is you are putting 1/48 at wrong position.
The cron expression has specific place for unit of time.
Minute Hour Day Month Weekday
if you want to execute the job every 48 hours you should something like this :
0 */48 * * *
or if you want to execute the job once in 2 days then you could use something like below:
0 0 */2 * *
Let me know if this is helpful for you.

Run CRON job everyday at specific time

Right now i am running my cron job everyday at 3.00PM
0 15 * * *
But I want to run my cron job twice in a day. 10.30AM and 2.30PM
0 30 10 * * *
I believe this command will run at 10.30AM. How should i run it in 2.30PM?
Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on-going basis.
Linux Crontab Format
MIN HOUR DOM MON DOW CMD
Example::Scheduling a Job For a Specific Time
The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.
Please note that the time field uses 24 hours format. So, for 8 AM use
8, and for 8 PM use 20.
30 08 10 06 * /home/yourname/full-backup
30 – 30th Minute
08 – 08 AM
10 – 10th Day
06 – 6th Month (June)
*– Every day of the week
In your case, for 2.30PM,
30 14 * * * YOURCMD
30 – 30th Minute
14 – 2PM
*– Every day
*– Every month
*– Every day of the week
To know more about cron, visit this website.
From cron manual http://man7.org/linux/man-pages/man5/crontab.5.html:
Lists are allowed. A list is a set of numbers (or ranges) separated
by commas. Examples: "1,2,5,9", "0-4,8-12".
So in this case it would be:
30 10,14 * * *
you can write multiple lines in case of different minutes, for example you want to run at 10:01 AM and 2:30 PM
1 10 * * * php -f /var/www/package/index.php controller function
30 14 * * * php -f /var/www/package/index.php controller function
but the following is the best solution for running cron multiple times in a day as minutes are same, you can mention hours like 10,30 .
30 10,14 * * * php -f /var/www/package/index.php controller function

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

quartz cron to fire every 90 min starting midnight

I want a cron job (or a combination of 2 jobs) which fires at 00:00, 01:30, 03:00 and so on for all day. What can be the most succinct way to write the expression?
you need to split it into 2 jobs since it is an odd frequency
0 0-21/3 * * * command
30 1-22/3 * * * command
Use following cron expression to configure your cron trigger
0 0/30 0,23 * * ?
Also See
Quarts doc

Resources