目次一覧
状態:-
閲覧数:1,119
投稿日:2019-04-23
更新日:2019-04-27
cron再起動 / crond デーモンの status を確認 / crond 設定ファイルの一覧を確認
crond ログ確認 / crontabタスクスケジューラー内容を確認 / crond 設定ファイル内容を確認
溜まった受信メールを確認
crond ログ確認 / crontabタスクスケジューラー内容を確認 / crond 設定ファイル内容を確認
溜まった受信メールを確認
cron再起動 / crond デーモンの status を確認 / crond 設定ファイルの一覧を確認
cron再起動
$ sudo systemctl restart crond
crond デーモンの status を確認
正常時
・エラー表示されない
$ sudo service crond status
Redirecting to /bin/systemctl status crond.service
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) since 木 2019-04-25 12:29:28 JST; 24h ago
Main PID: 24449 (crond)
CGroup: /system.slice/crond.service
└─24449 /usr/sbin/crond -n
4月 25 12:29:28 hoge.vs.sakura.ne.jp systemd[1]: Started Command Scheduler.
4月 25 12:29:28 hoge.vs.sakura.ne.jp systemd[1]: Starting Command Scheduler...
4月 25 12:29:28 hoge.vs.sakura.ne.jp crond[24449]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 69% if used.)
4月 25 12:29:28 hoge.vs.sakura.ne.jp crond[24449]: (CRON) INFO (running with inotify support)
4月 25 12:29:28 hoge.vs.sakura.ne.jp crond[24449]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
エラー時
・エラー表示される
$ sudo service crond status
Redirecting to /bin/systemctl status crond.service
● crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
Active: active (running) since 土 2019-04-20 01:01:06 JST; 3 days ago
Main PID: 22392 (crond)
CGroup: /system.slice/crond.service
└─22392 /usr/sbin/crond -n
4月 21 01:20:50 hoge.vs.sakura.ne.jp crond[22392]: sendmail: fatal: root(0): message file too big
4月 21 12:00:01 hoge.vs.sakura.ne.jp crond[22392]: (python) ERROR (getpwnam() failed)
4月 22 00:00:01 hoge.vs.sakura.ne.jp crond[22392]: (python) ERROR (getpwnam() failed)
4月 22 01:36:07 hoge.vs.sakura.ne.jp crond[22392]: postdrop: warning: uid=0: File too large
4月 22 01:36:08 hoge.vs.sakura.ne.jp crond[22392]: sendmail: fatal: root(0): message file too big
4月 22 12:00:01 hoge.vs.sakura.ne.jp crond[22392]: (python) ERROR (getpwnam() failed)
4月 23 00:00:01 hoge.vs.sakura.ne.jp crond[22392]: (python) ERROR (getpwnam() failed)
4月 23 01:35:07 hoge.vs.sakura.ne.jp crond[22392]: postdrop: warning: uid=0: File too large
4月 23 01:35:08 hoge.vs.sakura.ne.jp crond[22392]: sendmail: fatal: root(0): message file too big
4月 23 12:00:02 hoge.vs.sakura.ne.jp crond[22392]: (python) ERROR (getpwnam() failed)
crond 設定ファイルの一覧を確認
$ ls -l /etc/cron.d
合計 32
-rw-r--r-- 1 root root 128 3月 22 2018 0hourly
-rw-r--r-- 1 root root 130 7月 6 2018 access_analysis
-rw-r--r-- 1 root root 70 4月 9 2018 backup_by_database
-rw-r--r-- 1 root root 106 4月 20 00:46 certbot
-rw-r--r-- 1 root root 65 4月 20 00:20 letsencrypt
-rw-r--r-- 1 root root 64 4月 9 2018 mysql_backup
-rw-r--r-- 1 root root 110 4月 24 12:46 raid-check
-rw------- 1 root root 239 4月 24 12:47 sysstat
crond ログ確認 / crontabタスクスケジューラー内容を確認 / crond 設定ファイル内容を確認
crond ログ確認
$ sudo less /var/log/cron
crontabタスクスケジューラー内容を確認
$ less /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
#MAILTO=root
MAILTO="xx9xxxxx@yahoo.co.jp"
# 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
crond 設定ファイル内容を確認
$ less /etc/cron.d/作成したした任意のファイル名
$ less /etc/cron.d/letsencrypt
1 4 * * * root /usr/bin/certbot renew && systemctl restart nginx
溜まった受信メールを確認
溜まった受信メールを確認
$ ls -l /var/spool/mail
合計 100
-rw-rw---- 1 ★★ mail 4758 1月 23 10:30 ★★
-rw------- 1 nginx mail 37751 3月 13 17:17 nginx
-rw------- 1 root mail 50768 4月 27 06:11 root