crontab not working centos 6.9

General support questions
serverbd
Posts: 1
Joined: 2018/01/08 17:47:33

crontab not working centos 6.9

Postby serverbd » 2018/01/08 17:50:49

im trying to remove my Cache folder with cron but cron not auto start when i set it
i just set it for 5 minute to test it work or not

5 * * * * root rm -rf /usr/share/httpd/720p/public_html/Cache/

im using centos 6.9
its a virtual host

pjsr2
Posts: 240
Joined: 2014/03/27 20:11:07

Re: crontab not working centos 6.9

Postby pjsr2 » 2018/01/09 09:40:52

There are two types of cron jobs: system jobs (in the /etc/cron.d directory) and the "per user" jobs that are maintained by the crontab (and located in the /var/spool/cron directory).
There is a difference in the format of the "per user" crontab files and "system" cron files: in cron files the 6th field is the user name, whereas crontab files don't need user name there. You should remove "root" from the line.