Rocky linux 9.3 (CRON) bad minute,why?

My file /etc/crontab:

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

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
0 23 *  *  6  root   /etc/cron.d/bakweb_nfs.sh > /etc/cron.d/exec_bakweb.log 2>&1

then I run
systemctl restart crond
but
systemctl status crond
I can find

● crond.service - Command Scheduler
     Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-12-19 10:15:46 CST; 2s ago
   Main PID: 187040 (crond)
      Tasks: 2 (limit: 23093)
     Memory: 2.5M
        CPU: 7ms
     CGroup: /system.slice/crond.service
             ├─182382 /usr/sbin/anacron -s
             └─187040 /usr/sbin/crond -n

Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) bad minute (/etc/cron.d/bakweb_nfs.sh)
Dec 19 10:15:46 us3 crond[187040]: (CRON) INFO (@reboot jobs will be run at computer's startup.)

why?

Cron expects the files under /etc/cron.d to be additional crontab files like /etc/crontab. (In fact, you probably already have one named 0hourly.) Moving your backweb_nfs.sh script and log file somewhere else should solve the error.

mv file to /opt,then the cron is ok,thank you!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.