Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 913
Matarishvan Avatar asked Feb 23 '16 10:02

Matarishvan


People also ask

How do I schedule a cron job daily?

Scheduling a Job For a Specific TimeAdd the below example to execute the specified log backup shell script at 11:00 on every day. We can specify the comma-separated value in a field specifies that the script needs to be executed in all the mentioned time.

How do I set up cron to run a file just once at 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.

How do I schedule a cron job every 12 hours?

Show activity on this post. ->cron('0 */12 * * *'); This cron will run the scheduler at every 12 hours.

What time does cron daily run?

Approximately 7:35am, but the exact timing will depend on anacron. which says run these jobs once per day, with a delay of 5 minutes. anacron itself is run by cron, as specified in the file /etc/cron.


1 Answers

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

enter image description here

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 
  1. 30 – 30th Minute
  2. 14 – 2PM
  3. *– Every day
  4. *– Every month
  5. *– Every day of the week

To know more about cron, visit this website.

like image 110
Renjith V R Avatar answered Oct 26 '22 07:10

Renjith V R