Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crontab every 5 minutes [closed]

Tags:

How could i tell crontab to run every 5 minutes, but starting at the second minute of the hour. In other words, i would like to execute my script when minute % 5 = 2.

For example, my script should run at :

08:02 08:07 08:12 08:17 ... 

Thanks for your help!

like image 515
Arnaud Avatar asked Jun 29 '12 10:06

Arnaud


People also ask

How do I schedule a cron job every 5 minutes?

tiny 4. /bin/ed Choose 1-4 [1]: Make a new line at the bottom of this file and insert the following code. Of course, replace our example script with the command or script you wish to execute, but keep the */5 * * * * part as that is what tells cron to execute our job every 5 minutes. Exit this file and save changes.

What does 0 * * * * mean in crontab?

0 * * * * Execute a cron job every hour. 0 12 * * * Fire at 12:00 PM (noon) every day.

How we can set crontab after every 5 seconds?

In a cron we can not schedule a job in seconds interval. i.e You cannot schedule a cron job to run every 5 seconds.

How do I run a cron job every minute?

How does it work? The asterisk (*) operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month. An asterisk in the every field means run given command/script every minute.


1 Answers

There are two possibilities:

2,7,12,17... command */5 ....     sleep 120 ; command 
  1. Write explicit all minutes in crontab
  2. Run sleep command before the actual command
like image 124
Igor Chubin Avatar answered Sep 19 '22 23:09

Igor Chubin