tDiaryのログをファイルに書き出す
Webrickで動かしているtDiaryは、ログが標準出力に吐き出されて不便な事があるので、起動スクリプト側で/var/log配下に吐き出すようにした。 webrickからunicornにすれば、そもそも解決しそうだがとりあえず応急処置。
# chkconfig: - 60 1\5 # processname: tDiaryServer # pidfile: /www/html/tdiary/tdiary.pid # description: tDiary Server RBENV_ROOT=/opt/rbenv/ PATH=$RBENV_ROOT:/sbin:/usr/sbin:/bin:/usr/bin DESC="tDiary server" NAME=tdiary PIDFILE=$NAME.pid TDIARY_PATH="/www/html/tdiary" case "$1" in start) echo -n "Starting tDiary..." cd $TDIARY_PATH (/opt/rbenv/shims/bundle exec tdiary server -p 51980 >> /var/log/tdiary`date +%Y%m%d`.log 2>&1) & ;; stop) echo -n "Stopping tDiary..." kill -9 `cat /www/html/tdiary/tdiary.pid` ;; restart) $0 stop $0 start ;; status) status -p `cat /www/html/tdiary/tdiary.pid` tdiary ;; *) echo "Usage:$0 {start|stop|restart}" exit 1; ;; esac