Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 35773  / 3 Years ago, tue, may 11, 2021, 8:53:13

Ubuntu Server 12.04. I use:



sudo crontab -e
* * * * * root /etc/init.d/apache2 restart > /dev/null 2>&1
sudo restart cron


And it doesnt work. How to fix it? So many docs in google,I need one "true way".


More From » 12.04

 Answers
6

I'm assuming that you have exited the cron tab after the 2nd statement.
That third line won't work in crontab. Cron should reload itself.



The issue with your cron tab is that you have it set to run every minute of every hour of every day ect. That what the * means, all options.



View this in coumn format



` m - h  dom mon dow    command

* * * * * root /etc/init.d/apache2 restart > /dev/null 2>&1


You need



0  1  * * * root /etc/init.d/apache2 restart > /dev/null 2>&1


This is the the 0th minute of the 1st hour, every day.


[#31911] Thursday, May 13, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nuehan

Total Points: 253
Total Questions: 109
Total Answers: 120

Location: Singapore
Member since Sat, Jul 25, 2020
4 Years ago
nuehan questions
Sun, Dec 18, 22, 17:34, 1 Year ago
Mon, Mar 28, 22, 00:10, 2 Years ago
Fri, Jun 24, 22, 11:39, 2 Years ago
Thu, Apr 28, 22, 20:54, 2 Years ago
Fri, Aug 20, 21, 01:06, 3 Years ago
;