Cannot make CRON work for user on CentOS 7

时间:2017-10-30 15:34:09

标签: cron centos centos7

This is file /var/spool/cron/[USER]:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

0 */2 * * * /usr/bin/wget -O - http://[WEBSITE]/[STUFF] >/dev/null 2>&1

I made this CRON to visit website every second hour. But it is not working, because when I type command about CRON status, then it says this:

$ systemctl status crond
● crond.service - Command Scheduler
   Loaded: loaded ...
   Active: active (running) ...

...
crond[6967]: (CRON) bad minute (/var/spool/cron/[USER])
...

It is weird, because when I move it to the /var/spool/cron/root, then it works. This "bad minute" shows only for other users. But why?

CHMOD is 600 and owner is the user I talk about.

1 个答案:

答案 0 :(得分:1)

我认为您不应该直接编辑cron文件,使用此命令登录到正确的用户时是否尝试过编辑它?

crontab -e

还要检查/ etc / crontab文件是否正确

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly