2011年6月7日火曜日

めったに起動しない VMware 上の Debian Squeeze の logrotate

ことのおこり

未だに /etc/logsyslog.1 が現れないので不安になって。

たぶんこう

logrotate くんは,/etc/cron.daily/logrotate で動いていて,cron.daily って /etc/crontab

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
 
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cro
n.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cro
n.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cro
n.monthly )
#
ええと, 6:25 に動くことになっているのかな?

…そんな時刻には起動していないのである。

手動くーろん

くーろんって呼ぶよね?呼ぶよね?

閑話休題。まずは直接コマンド打ってみましょう。どうせ cron.daily 自体が動いていないのだから……。

$ sudo run-parts --report /etc/cron.daily
ん゛~。/var/log/syslog.1 が出来ないよ?

いぢったものたち

/etc/logrotate.conf

…はこんな感じ。

# see "man logrotate" for details
# rotate log files weekly
weekly
 
# keep 4 weeks worth of backlogs
rotate 4
weekly といっておられる部分を daily に変更。 daily なら 28 日かな~?

/var/lib/logrotate/status

Debian ではここみたい。ぐぐってると /var/lib/logrotate.status ってあるとこが多いけれど。これを昨日にしちゃえばいいのかな?

けっか

もういちど手動くーろんかましたら syslog.1 できました。

…ここまで書いているうちに,anacron とやらを発見。これ入れときゃいかったんでは……。

0 件のコメント: