安装linux系统时候,忘记选择时区了,造成crontab和ntp update不能正确执行获得正确的时间。最后通过修改时区的方式搞定,推荐tzselect。重点不在这里。重点是时间改好了。但是无法正确执行业务,找了半天问题。需要重新启动crond和rsyslog服务就可以了
[root@localhost ~]# tail -F /var/log/cron Sep 5 20:18:01 localhost crond[2311]: (CRON) INFO (Shutting down) Sep 5 20:18:01 localhost crond[5972]: (CRON) STARTUP (1.4.4) Sep 5 20:18:01 localhost crond[5972]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 37% if used.) Sep 5 20:18:02 localhost crond[5972]: (CRON) INFO (running with inotify support) Sep 5 20:18:02 localhost crond[5972]: (CRON) INFO (@reboot jobs will be run at computer's startup.) Sep 5 20:18:10 localhost crontab[5974]: (root) BEGIN EDIT (root) Sep 5 20:18:42 localhost crontab[5974]: (root) REPLACE (root) Sep 5 20:18:42 localhost crontab[5974]: (root) END EDIT (root) Sep 5 20:19:01 localhost crond[5972]: (root) RELOAD (/var/spool/cron/root) Sep 5 20:20:01 localhost CROND[5986]: (root) CMD (/usr/lib64/sa/sa1 1 1) ^C [root@localhost ~]# service rsyslog restart Shutting down system logger: [ OK ] Starting system logger: [ OK ] [root@localhost ~]# tail -F /var/log/cron Sep 5 20:18:01 localhost crond[2311]: (CRON) INFO (Shutting down) Sep 5 20:18:01 localhost crond[5972]: (CRON) STARTUP (1.4.4) Sep 5 20:18:01 localhost crond[5972]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 37% if used.) Sep 5 20:18:02 localhost crond[5972]: (CRON) INFO (running with inotify support) Sep 5 20:18:02 localhost crond[5972]: (CRON) INFO (@reboot jobs will be run at computer's startup.) Sep 5 20:18:10 localhost crontab[5974]: (root) BEGIN EDIT (root) Sep 5 20:18:42 localhost crontab[5974]: (root) REPLACE (root) Sep 5 20:18:42 localhost crontab[5974]: (root) END EDIT (root) Sep 5 20:19:01 localhost crond[5972]: (root) RELOAD (/var/spool/cron/root) Sep 5 20:20:01 localhost CROND[5986]: (root) CMD (/usr/lib64/sa/sa1 1 1) ^C [root@localhost ~]# service crond restart Stopping crond: [ OK ] Starting crond: [ OK ] [root@localhost ~]# tail -F /var/log/cron Sep 5 20:18:10 localhost crontab[5974]: (root) BEGIN EDIT (root) Sep 5 20:18:42 localhost crontab[5974]: (root) REPLACE (root) Sep 5 20:18:42 localhost crontab[5974]: (root) END EDIT (root) Sep 5 20:19:01 localhost crond[5972]: (root) RELOAD (/var/spool/cron/root) Sep 5 20:20:01 localhost CROND[5986]: (root) CMD (/usr/lib64/sa/sa1 1 1) Sep 6 08:23:26 localhost crond[5972]: (CRON) INFO (Shutting down) Sep 6 08:23:26 localhost crond[6073]: (CRON) STARTUP (1.4.4) Sep 6 08:23:26 localhost crond[6073]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 50% if used.) Sep 6 08:23:27 localhost crond[6073]: (CRON) INFO (running with inotify support) Sep 6 08:23:27 localhost crond[6073]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
重启crond和rsyslog服务后。
[root@localhost ~]# date -R Sun, 06 Sep 2020 08:26:41 +0800 [root@localhost ~]#
关注这里:
Sep 5 20:20:01 localhost CROND[5986]: (root) CMD (/usr/lib64/sa/sa1 1 1) Sep 6 08:23:26 localhost crond[5972]: (CRON) INFO (Shutting down)