开启与关闭
[root@c ~]# systemctl status chronyd.service
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:chronyd(8)
man:chrony.conf(5)
[root@c ~]# man chronyd
[root@c ~]#
[root@c ~]# systemctl list-unit-files --type=service | grep cron
crond.service enabled
[root@c ~]# systemctl disable crond.service
Removed symlink /etc/systemd/system/multi-user.target.wants/crond.service.
[root@c ~]# systemctl list-unit-files --type=service | grep enabled
autovt@.service enabled
cups.service enabled
dmraid-activation.service enabled
getty@.service enabled
lm_sensors.service enabled
lvm2-monitor.service enabled
microcode.service enabled
NetworkManager-wait-online.service enabled
nscd.service enabled
ntpd.service enabled
postfix.service enabled
rhel-autorelabel-mark.service enabled
rhel-autorelabel.service enabled
rhel-configure.service enabled
rhel-dmesg.service enabled
rhel-domainname.service enabled
rhel-import-state.service enabled
rhel-loadmodules.service enabled
rhel-readonly.service enabled
rpcbind.service enabled
rsyslog.service enabled
sshd.service enabled
sysstat.service enabled
systemd-readahead-collect.service enabled
systemd-readahead-drop.service enabled
systemd-readahead-replay.service enabled
[root@c ~]# systemctl list-unit-files --type=service | grep disabled
abrt-ccpp.service disabled
abrt-oops.service disabled
abrt-pstoreoops.service disabled
abrt-vmcore.service disabled
abrt-xorg.service disabled
abrtd.service disabled
aliyun.service disabled
arp-ethers.service disabled
atd.service disabled
auditd.service disabled
avahi-daemon.service disabled
blk-availability.service disabled
chrony-wait.service disabled
chronyd.service disabled
console-getty.service disabled
console-shell.service disabled
cpupower.service disabled
crond.service disabled
cups-browsed.service disabled
debug-shell.service disabled
dnsmasq.service disabled
ebtables.service disabled
fancontrol.service disabled
firewalld.service disabled
iprdump.service disabled
iprinit.service disabled
iprupdate.service disabled
irqbalance.service disabled
kdump.service disabled
kpatch.service disabled
libstoragemgmt.service disabled
mdmonitor.service disabled
NetworkManager-dispatcher.service disabled
NetworkManager.service disabled
nfs-rquotad.service disabled
ntpdate.service disabled
plymouth-halt.service disabled
plymouth-kexec.service disabled
plymouth-poweroff.service disabled
plymouth-quit-wait.service disabled
plymouth-quit.service disabled
plymouth-read-write.service disabled
plymouth-reboot.service disabled
plymouth-start.service disabled
psacct.service disabled
rdisc.service disabled
rdma.service disabled
rngd.service disabled
rpc-rquotad.service disabled
rsyncd.service disabled
serial-getty@.service disabled
smartd.service disabled
svnserve.service disabled
systemd-bootchart.service disabled
systemd-nspawn@.service disabled
tcsd.service disabled
tuned.service disabled
wpa_supplicant.service disabled
[root@c ~]# systemctl enable crond.service
Created symlink from /etc/systemd/system/multi-user.target.wants/crond.service to /usr/lib/systemd/system/crond.service.
[root@c ~]# systemctl list-unit-files --type=service | grep enabled
autovt@.service enabled
crond.service enabled
cups.service enabled
dmraid-activation.service enabled
getty@.service enabled
lm_sensors.service enabled
lvm2-monitor.service enabled
microcode.service enabled
NetworkManager-wait-online.service enabled
nscd.service enabled
ntpd.service enabled
postfix.service enabled
rhel-autorelabel-mark.service enabled
rhel-autorelabel.service enabled
rhel-configure.service enabled
rhel-dmesg.service enabled
rhel-domainname.service enabled
rhel-import-state.service enabled
rhel-loadmodules.service enabled
rhel-readonly.service enabled
rpcbind.service enabled
rsyslog.service enabled
sshd.service enabled
sysstat.service enabled
systemd-readahead-collect.service enabled
systemd-readahead-drop.service enabled
systemd-readahead-replay.service enabled
[root@c ~]#
[root@c ~]# cat /etc/systemd/system/multi-user.target.wants/crond.service
[Unit]
Description=Command Scheduler
After=auditd.service systemd-user-sessions.service time-sync.target
[Service]
EnvironmentFile=/etc/sysconfig/crond
ExecStart=/usr/sbin/crond -n $CRONDARGS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
[Install]
WantedBy=multi-user.target
[root@c ~]#
检查开机启动历史
[root@c ~]# journalctl -b | grep cron
Mar 11 16:50:57 oldhostname crond[3824]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 45% if used.)
Mar 11 16:50:57 oldhostname crond[3824]: (CRON) INFO (running with inotify support)
Mar 11 17:01:01 oldhostname CROND[5218]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 17:01:01 oldhostname run-parts(/etc/cron.hourly)[5222]: starting 0anacron
Mar 11 17:01:01 oldhostname run-parts(/etc/cron.hourly)[5228]: finished 0anacron
Mar 11 17:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 11 18:01:01 oldhostname CROND[8454]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 18:01:01 oldhostname run-parts(/etc/cron.hourly)[8458]: starting 0anacron
Mar 11 18:01:01 oldhostname run-parts(/etc/cron.hourly)[8464]: finished 0anacron
Mar 11 18:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 11 19:01:01 oldhostname CROND[11678]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 19:01:01 oldhostname run-parts(/etc/cron.hourly)[11681]: starting 0anacron
Mar 11 19:01:01 oldhostname run-parts(/etc/cron.hourly)[11687]: finished 0anacron
Mar 11 19:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 11 20:01:01 oldhostname CROND[14901]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 20:01:01 oldhostname run-parts(/etc/cron.hourly)[14905]: starting 0anacron
Mar 11 20:01:01 oldhostname run-parts(/etc/cron.hourly)[14911]: finished 0anacron
Mar 11 20:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 11 21:01:01 oldhostname CROND[18151]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 21:01:01 oldhostname run-parts(/etc/cron.hourly)[18155]: starting 0anacron
Mar 11 21:01:01 oldhostname run-parts(/etc/cron.hourly)[18161]: finished 0anacron
Mar 11 21:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 11 22:01:02 oldhostname CROND[21403]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 22:01:02 oldhostname run-parts(/etc/cron.hourly)[21406]: starting 0anacron
Mar 11 22:01:02 oldhostname run-parts(/etc/cron.hourly)[21412]: finished 0anacron
Mar 11 22:01:02 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 11 23:01:01 oldhostname CROND[26081]: (root) CMD (run-parts /etc/cron.hourly)
Mar 11 23:01:01 oldhostname run-parts(/etc/cron.hourly)[26085]: starting 0anacron
Mar 11 23:01:01 oldhostname run-parts(/etc/cron.hourly)[26091]: finished 0anacron
Mar 11 23:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 00:01:01 oldhostname CROND[29353]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 00:01:01 oldhostname run-parts(/etc/cron.hourly)[29356]: starting 0anacron
Mar 12 00:01:01 oldhostname anacron[29363]: Anacron started on 2019-03-12
Mar 12 00:01:01 oldhostname run-parts(/etc/cron.hourly)[29365]: finished 0anacron
Mar 12 00:01:01 oldhostname anacron[29363]: Normal exit (0 jobs run)
Mar 12 00:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 00:25:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 00:25:05 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 00:28:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 00:40:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 01:00:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 01:01:01 oldhostname CROND[1452]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 01:01:01 oldhostname run-parts(/etc/cron.hourly)[1456]: starting 0anacron
Mar 12 01:01:01 oldhostname anacron[1463]: Anacron started on 2019-03-12
Mar 12 01:01:01 oldhostname anacron[1463]: Normal exit (0 jobs run)
Mar 12 01:01:01 oldhostname run-parts(/etc/cron.hourly)[1465]: finished 0anacron
Mar 12 01:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 01:05:05 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 01:10:05 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 02:01:01 oldhostname CROND[5104]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 02:01:01 oldhostname run-parts(/etc/cron.hourly)[5107]: starting 0anacron
Mar 12 02:01:01 oldhostname anacron[5114]: Anacron started on 2019-03-12
Mar 12 02:01:01 oldhostname anacron[5114]: Normal exit (0 jobs run)
Mar 12 02:01:01 oldhostname run-parts(/etc/cron.hourly)[5116]: finished 0anacron
Mar 12 02:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 03:01:01 oldhostname CROND[8402]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 03:01:01 oldhostname run-parts(/etc/cron.hourly)[8405]: starting 0anacron
Mar 12 03:01:01 oldhostname anacron[8412]: Anacron started on 2019-03-12
Mar 12 03:01:01 oldhostname anacron[8412]: Will run job `cron.daily' in 15 min.
Mar 12 03:01:01 oldhostname anacron[8412]: Jobs will be executed sequentially
Mar 12 03:01:01 oldhostname run-parts(/etc/cron.hourly)[8414]: finished 0anacron
Mar 12 03:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 03:16:01 oldhostname anacron[8412]: Job `cron.daily' started
Mar 12 03:16:01 oldhostname run-parts(/etc/cron.daily)[9256]: starting logrotate
Mar 12 03:16:01 oldhostname run-parts(/etc/cron.daily)[9261]: finished logrotate
Mar 12 03:16:01 oldhostname run-parts(/etc/cron.daily)[9263]: starting man-db.cron
Mar 12 03:16:01 oldhostname run-parts(/etc/cron.daily)[9274]: finished man-db.cron
Mar 12 03:16:01 oldhostname run-parts(/etc/cron.daily)[9276]: starting mlocate
Mar 12 03:16:10 oldhostname run-parts(/etc/cron.daily)[9292]: finished mlocate
Mar 12 03:16:10 oldhostname anacron[8412]: Job `cron.daily' terminated
Mar 12 03:16:10 oldhostname anacron[8412]: Normal exit (1 job run)
Mar 12 04:01:01 oldhostname CROND[11814]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 04:01:01 oldhostname run-parts(/etc/cron.hourly)[11818]: starting 0anacron
Mar 12 04:01:01 oldhostname run-parts(/etc/cron.hourly)[11824]: finished 0anacron
Mar 12 04:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 05:01:01 oldhostname CROND[15164]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 05:01:01 oldhostname run-parts(/etc/cron.hourly)[15168]: starting 0anacron
Mar 12 05:01:01 oldhostname run-parts(/etc/cron.hourly)[15174]: finished 0anacron
Mar 12 05:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 06:01:01 oldhostname CROND[18639]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 06:01:01 oldhostname run-parts(/etc/cron.hourly)[18642]: starting 0anacron
Mar 12 06:01:01 oldhostname run-parts(/etc/cron.hourly)[18648]: finished 0anacron
Mar 12 06:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 07:01:01 oldhostname CROND[21905]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 07:01:01 oldhostname run-parts(/etc/cron.hourly)[21908]: starting 0anacron
Mar 12 07:01:01 oldhostname run-parts(/etc/cron.hourly)[21914]: finished 0anacron
Mar 12 07:01:02 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 08:01:01 oldhostname CROND[25144]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 08:01:01 oldhostname run-parts(/etc/cron.hourly)[25147]: starting 0anacron
Mar 12 08:01:01 oldhostname run-parts(/etc/cron.hourly)[25153]: finished 0anacron
Mar 12 08:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 09:01:01 oldhostname CROND[28642]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 09:01:01 oldhostname run-parts(/etc/cron.hourly)[28645]: starting 0anacron
Mar 12 09:01:01 oldhostname run-parts(/etc/cron.hourly)[28651]: finished 0anacron
Mar 12 09:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 10:01:01 oldhostname CROND[32197]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 10:01:01 oldhostname run-parts(/etc/cron.hourly)[32201]: starting 0anacron
Mar 12 10:01:01 oldhostname run-parts(/etc/cron.hourly)[32207]: finished 0anacron
Mar 12 10:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 11:01:01 oldhostname CROND[4758]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 11:01:01 oldhostname run-parts(/etc/cron.hourly)[4762]: starting 0anacron
Mar 12 11:01:01 oldhostname run-parts(/etc/cron.hourly)[4768]: finished 0anacron
Mar 12 11:01:01 oldhostname crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 12:01:01 c CROND[9348]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 12:01:01 c run-parts(/etc/cron.hourly)[9351]: starting 0anacron
Mar 12 12:01:01 c run-parts(/etc/cron.hourly)[9357]: finished 0anacron
Mar 12 12:01:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 12:25:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 12:28:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 13:01:01 c CROND[12647]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 13:01:01 c run-parts(/etc/cron.hourly)[12650]: starting 0anacron
Mar 12 13:01:01 c run-parts(/etc/cron.hourly)[12656]: finished 0anacron
Mar 12 13:01:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 14:01:01 c CROND[15964]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 14:01:01 c run-parts(/etc/cron.hourly)[15968]: starting 0anacron
Mar 12 14:01:01 c run-parts(/etc/cron.hourly)[15974]: finished 0anacron
Mar 12 14:01:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 15:01:01 c CROND[19255]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 15:01:01 c run-parts(/etc/cron.hourly)[19259]: starting 0anacron
Mar 12 15:01:01 c run-parts(/etc/cron.hourly)[19265]: finished 0anacron
Mar 12 15:01:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 16:01:01 c CROND[22524]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 16:01:01 c run-parts(/etc/cron.hourly)[22527]: starting 0anacron
Mar 12 16:01:01 c run-parts(/etc/cron.hourly)[22533]: finished 0anacron
Mar 12 16:01:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 17:01:01 c CROND[25780]: (root) CMD (run-parts /etc/cron.hourly)
Mar 12 17:01:01 c run-parts(/etc/cron.hourly)[25784]: starting 0anacron
Mar 12 17:01:01 c run-parts(/etc/cron.hourly)[25790]: finished 0anacron
Mar 12 17:01:01 c crond[3824]: sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Mar 12 17:33:22 c crontab[27554]: (root) LIST (root)
[root@c ~]#
分析某个服务的运行情况
查看cron定时任务日志
cat /var/log/cron