Patrik Krehák
Patrik Krehák

Reputation: 2683

Cannot make CRON work for user on CentOS 7

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.

Upvotes: 0

Views: 3528

Answers (1)

dahe
dahe

Reputation: 846

I think you shouldn't edit the cron file directly, have you tried editing it when logged in to the correct user with this command:

crontab -e

Also check that your /etc/crontab file is correct

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

Upvotes: 1

Related Questions