/etc/anacrontab:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root
# These replace cron's entries
1 5 cron.daily run-parts --report /etc/cron.daily
7 10 cron.weekly run-parts --report /etc/cron.weekly
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly
/etc/cron.d/anacron:
# /etc/cron.d/anacron: crontab entries for the anacron package
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
30 7-23 * * * root [ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi
これは、cronがanacronを実行せずにsystemdに任せるという意味です。そうですか?ただし、関連するシステムタイマーは表示されません。
$ systemctl list-timers --all
NEXT LEFT LAST PASSED UNIT ACTIVATES
Sun 2023-10-29 11:36:44 CET 17min Sun 2023-10-29 10:03:38 CET 1h 15min ago fwupd-refresh.timer fwupd-refresh.service
Sun 2023-10-29 17:27:57 CET 6h Sat 2023-10-28 18:27:57 CEST 17h ago etckeeper.timer etckeeper.service
Sun 2023-10-29 17:27:57 CET 6h Sat 2023-10-28 18:27:57 CEST 17h ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Sun 2023-10-29 18:07:00 CET 6h Sun 2023-10-29 09:22:36 CET 1h 56min ago apt-daily.timer apt-daily.service
Mon 2023-10-30 00:00:00 CET 12h Sun 2023-10-29 00:00:01 CEST 12h ago apt-show-versions.timer apt-show-versions.service
Mon 2023-10-30 00:00:00 CET 12h Sun 2023-10-29 00:00:01 CEST 12h ago dpkg-db-backup.timer dpkg-db-backup.service
Mon 2023-10-30 00:00:00 CET 12h Sun 2023-10-29 00:00:01 CEST 12h ago logrotate.timer logrotate.service
Mon 2023-10-30 01:29:34 CET 14h Mon 2023-10-23 08:14:40 CEST - fstrim.timer fstrim.service
Mon 2023-10-30 06:22:39 CET 19h Sun 2023-10-29 10:19:49 CET 59min ago man-db.timer man-db.service
Mon 2023-10-30 06:25:00 CET 19h Sun 2023-10-29 06:25:01 CET 4h 54min ago ntpsec-rotate-stats.timer ntpsec-rotate-stats.service
Mon 2023-10-30 06:46:54 CET 19h Sun 2023-10-29 06:25:35 CET 4h 53min ago apt-daily-upgrade.timer apt-daily-upgrade.service
Sun 2023-11-05 03:10:25 CET 6 days Sun 2023-10-29 03:10:49 CET 8h ago e2scrub_all.timer e2scrub_all.service
実行sudo anacron -n
時に実行をトリガーします。
実行後 /var/log/cron.log:
2023-10-25T16:46:45.570141+03:00 hostname anacron[704597]: Anacron 2.3 started on 2023-10-25
2023-10-25T16:46:45.578029+03:00 hostname anacron[704597]: Will run job `cron.daily'
2023-10-25T16:46:45.578146+03:00 hostname anacron[704597]: Will run job `cron.monthly'
2023-10-25T16:46:45.578220+03:00 hostname anacron[704597]: Jobs will be executed sequentially
2023-10-25T16:46:45.578716+03:00 hostname anacron[704597]: Job `cron.daily' started
2023-10-25T16:46:45.583688+03:00 hostname anacron[704605]: Updated timestamp for job `cron.daily' to 2023-10-25
2023-10-25T16:47:23.041584+03:00 hostname anacron[704597]: Job `cron.daily' terminated (mailing output)
2023-10-25T16:47:23.042011+03:00 hostname anacron[704597]: Job `cron.monthly' started
2023-10-25T16:47:23.047447+03:00 hostname anacron[705937]: Updated timestamp for job `cron.monthly' to 2023-10-25
2023-10-25T16:47:23.047590+03:00 hostname anacron[704597]: Job `cron.monthly' terminated
2023-10-25T16:47:23.055468+03:00 hostname anacron[704597]: Tried to mail output of job `cron.daily', but mailer process (/usr/sbin/sendmail) exited with status 78
2023-10-25T16:47:23.055626+03:00 hostname anacron[704597]: Normal exit (2 jobs run)
週刊誌が連載されない理由は何だろうか?
編集者:日刊新聞もそうしないでしょう。作成日hosts-block-update-daily
/etc/cron.daily
#!/usr/bin/env bash
echo "start @ $(date)" >> /home/mylocaluser/hosts-update-daily.log
そして何も記録されていません。以下の説明で説明するように、anacronを手動で実行した場合にのみ実行されます。