Penのログをローテートするためのスクリプトです。man penに書いてある以下を参考に作りました。
Sending pen a HUP signal will make it close and reopen the logfile, if logging is enabled, and reload the configuration file. Rotate the log like this (assuming pen.log is the name of the log- file): mv pen.log pen.log.1 kill -HUP ‘cat‘ where is the file containing pen’s process id, as written by the -p option.
cronで適当に動かすようにしとけばおkです。
% cat penLogRotate.sh #!/bin/sh PENHOME=/home/hoge/pen PIDFILE=$PENHOME/pen.pid LOG_FILE_NAME=pen.log.`date +%Y%m%d.%H%M%S` cd $PENHOME mv pen.log $LOG_FILE_NAME kill -HUP `cat $PIDFILE`
cronの設定はこんな感じで
0 0 * * * /home/hoge/pen/penLogRotate.sh
ではでは