自 3.1 版本以后,seaf-server 和 ccnet-server 支持通過接收 SIGUR1 信號來管理日志文件。
這個功能在你需要剪切日志文件但是不想關(guān)閉服務(wù)器的時候非常有用。
注意: 此功能在 Windows 下并不適用
對于 Debian, logrotate 默認存儲在 /etc/logrotate.d/
假設(shè)你的 ccnet-server 的日志文件是 /home/haiwen/logs/ccnet.log
, ccnet-server 進程的 pidfile 是 /home/haiwen/pids/ccnet.pid
. seaf-server's 的日志文件是 /home/haiwen/logs/seaf-server.log
, seaf-server 進程的 pidfile 是 /home/haiwen/pids/seaf-server.pid
:
則請按如下配置 logroate:
/home/haiwen/logs/seaf-server.log
{
daily
missingok
rotate 52
compress
delaycompress
notifempty
sharedscripts
postrotate
[ ! -f /home/haiwen/pids/seaf-server.pid ] || kill -USR1 `cat /home/haiwen/pids/seaf-server.pid`
endscript
}
/home/haiwen/logs/ccnet.log
{
daily
missingok
rotate 52
compress
delaycompress
notifempty
sharedscripts
postrotate
[ ! -f /home/haiwen/pids/ccnet.pid ] || kill -USR1 `cat /home/haiwen/pids/ccnet.pid`
endscript
}
對于 Debian 用戶, 可以將以上配置文件存儲在 /etc/logrotate.d/seafile
更多建議: