logroteで設定しcronで動かすように設定してるのですが・・。
(logorote.confとcorntabには 0 0 * * * root run-parts /etc/cron.daily)
昨日設定して今朝確認したところ動いておりませんでした。
手動実行(sudo logrotate -f /etc/logrotate.conf)しましたが、それは普通に動いてました。
調べてみるとlogorote.timerなるものがあるようですが該当のフォルダには
無かったです。
パッケージなどはyumで調べてみましたが当たりがつきません。。
どうすればcronで動くようになりますでしょうか。
デフォルトのままであればlogorote.confで週次の4週分バックアップとしては動作は
していたのですが何が悪かったのかわかりません。
どうぞよろしくお願い致します。
[root@hogehoge timers.target.wants]# ls -l
total 3
lrwxrwxrwx. 1 root root 43 May 5 2021 dnf-makecache.timer
lrwxrwxrwx. 1 root root 44 May 5 2021 nm-cloud-setup.timer
lrwxrwxrwx. 1 root root 44 May 5 2021 unbound-anchor.timer
> logroteで設定しcronで動かすように設定してるのですが・・。
> (logorote.confとcorntabには 0 0 * * * root run-parts /etc/cron.daily)
cronからlogrotateを動かす設定にしている部分を質問文に追記しましょう。どのファイルに何と書いてあるか。
2行目に記載しておりますが・・・。
それは、cronから/etc/cron.dally/*を起動するという記述です。
配下のlogoroteがありますが、そこはデフォルトのままです。
/etc/cron.daily/logrotate が存在して、中に、/usr/sbin/logrotate /etc/logrotate.conf の記述があると言うことですか?
logについての記述が無いのですが、見てないのであれば、cronのlogを見てみましょう。
ご連絡ありがとうございます。
logrotateの記述はデフォルトのままで指摘の/usr/sbin/logrotate /etc/logrotate.confはあります。
###################################
[root@hoge cron.daily]# cat logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE
###################################
cronのログですは指定してる時間からのログは以下でした
Mar 15 00:00:02 OaSovi_mark2 CROND[12716]: (root) CMD (root run-parts /etc/cron.daily)
Mar 15 00:00:02 OaSovi_mark2 CROND[12703]: (root) CMDOUT (/bin/sh: root: command not found)
Mar 15 00:01:01 OaSovi_mark2 CROND[12728]: (root) CMD (run-parts /etc/cron.hourly)
Mar 15 00:01:01 OaSovi_mark2 run-parts[12728]: (/etc/cron.hourly) starting 0anacron
Mar 15 00:01:01 OaSovi_mark2 anacron[12737]: Anacron started on 2023-03-15
Mar 15 00:01:01 OaSovi_mark2 anacron[12737]: Normal exit (0 jobs run)
Mar 15 00:01:01 OaSovi_mark2 run-parts[12728]: (/etc/cron.hourly) finished 0anacron
Mar 15 01:01:01 OaSovi_mark2 CROND[12853]: (root) CMD (run-parts /etc/cron.hourly)
Mar 15 01:01:01 OaSovi_mark2 run-parts[12853]: (/etc/cron.hourly) starting 0anacron
Mar 15 01:01:01 OaSovi_mark2 anacron[12862]: Anacron started on 2023-03-15
Mar 15 01:01:01 OaSovi_mark2 anacron[12862]: Normal exit (0 jobs run)
Mar 15 01:01:01 OaSovi_mark2 run-parts[12853]: (/etc/cron.hourly) finished 0anacron
どうぞよろしくお願い致します。
追加です。
anacrontabについてはコメントアウトして稼働させないようにしてました。
[root@hoge log]# cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
#1 5 cron.daily nice run-parts /etc/cron.daily
#7 25 cron.weekly nice run-parts /etc/cron.weekly
#@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
回答2件
あなたの回答
tips
プレビュー