From: Fredrik Tolf Date: Tue, 15 Feb 2011 21:58:48 +0000 (+0100) Subject: Added a sample script for logfile rotation. X-Git-Tag: 0.7~10 X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=commitdiff_plain;h=a3314fb7b0da8cd62a3b23234d347b1e61accedd Added a sample script for logfile rotation. --- diff --git a/etc/debian/cron.weekly-ashd b/etc/debian/cron.weekly-ashd new file mode 100755 index 0000000..e19a63e --- /dev/null +++ b/etc/debian/cron.weekly-ashd @@ -0,0 +1,14 @@ +#!/bin/sh + +LOGDIR=/var/log/http +CYCLE=7 + +cd "$LOGDIR" + +for log in *.log; do + if [ -e "$log" ]; then + pid="$(accesslog -P "$log" 2>/dev/null)" + savelog -qpt -c "$CYCLE" "$log" + if [ -n "$pid" ] && [ "$pid" -ne 0 ]; then kill -HUP "$pid"; fi + fi +done