How to set a cron job to run at a specific time?

I have a cron job that runs once a day. But I would like it to start at midnight or at another time for sure.

+60
cron
Mar 04 '11 at 23:52
source share
3 answers

You can also specify exact values ​​for each gr

0 2,10,12,14,16,18,20 * * *

It costs 2 hours, 10 hours, 12 hours and so on, until 20:00.

From the answer above we have:

Comma "," means "and". If you are confused by the line above, remember that spaces are field separators, not commas.

And with ( Wikipedia page ):

* * * * * command to be executed ┬ ┬ ┬ ┬ ┬ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └───── day of week (0 - 7) (0 or 7 are Sunday, or use names) β”‚ β”‚ β”‚ └────────── month (1 - 12) β”‚ β”‚ └─────────────── day of month (1 - 31) β”‚ └──────────────────── hour (0 - 23) └───────────────────────── min (0 - 59) 

Hope it helps :)

-

EDIT:

  • do not miss the 1st 0 (zero) and the following space: it means β€œminute of zero”, you can also set it to 15 (15th minute) or expressions like * / 15 (every minute is divided by 15, i.e. 0, 15.30)
+115
Apr 22 '13 at 18:06
source share

verify

http://www.thesitewizard.com/general/set-cron-job.shtml

for the specifics of setting up your crontab directives.

  45 10 * * * 

will work in the 10th, 45th minute of every day.

at midnight ... maybe

  0 0 * * * 
+31
Mar 04 2018-11-11T00:
source share

My use is that I am in a metric account. Data transfer is limited on weekdays, Mon-Fri, from 6:00 to 18:00. I use a bandwidth limit, but somehow the data is still slipping around 1 GB per day!

I strongly suspected that it was nausea or sick, doing a large number of searches. My download machine is called "download." The following was my solution, using the above, to start and stop VM loading using KVM:

 # Stop download Mon-Fri, 6am 0 6 * * 1,2,3,4,5 root virsh shutdown download # Start download Mon-Fri, 6pm 0 18 * * 1,2,3,4,5 root virsh start download 

I think this is correct, and I hope this helps someone else.

+1
Sep 02 '15 at 15:07
source share



All Articles