Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I specify time in CRON considering YEAR?

Tags:

linux

cron

My task is to specify time in CRON considering YEAR field. How can i do it, or do u know any stuff which can help me on my linux server? thx

like image 413
mart7ini Avatar asked Oct 11 '11 10:10

mart7ini


People also ask

How do you specify the time zone in cron expression?

Thankfully, you can configure a specific timezone for your Cron job as follows: First, you need to export the TZ variable in your Shell script before any other Shell entries. Next, access your crontab and use the crontab environment variable CRON_TZ at the start of the crontab file.

What does 30 * * * * mean in crontab?

*/30 * * * * your_command. this means "run when the minute of each hour is evenly divisible by 30" (would run at: 1:30, 2:00, 2:30, 3:00, etc) example #3. 0,30 * * * * your_command. this means "run when the minute of each hour is 0 or 30" (would run at: 1:30, 2:00, 2:30, 3:00, etc)

How do I change the time on a cron job?

Newer versions use /etc/anacrontab . By default, cron. daily scripts are run at 4:02. Editing /etc/crontab will modify that time.

What does * 5 * * * mean in cron?

Run a Cron Job Every 5 Minutes However, typing the whole list can be tedious and prone to errors. The second option to specify a job to be run every 5 minutes hours is to use the step operator: */5 * * * * command. */5 means create a list of all minutes and run the job for every fifth value from the list.


2 Answers

Crontab (5) file format has no YEAR field. You could try running a cron job @yearly (at 00:00 on New Year's day) which looks at the current year using date(1) and updates the current crontab file to one appropriate for the new year.

like image 119
Max Avatar answered Sep 26 '22 07:09

Max


Standard cron doesn't support a year field, but it's worth noting that some implementations support an extended crontab format with a sixth year field, such as nnCron. Not every cron is created equal.

like image 21
nullability Avatar answered Sep 24 '22 07:09

nullability