From a3314fb7b0da8cd62a3b23234d347b1e61accedd Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Tue, 15 Feb 2011 22:58:48 +0100 Subject: [PATCH] Added a sample script for logfile rotation. --- etc/debian/cron.weekly-ashd | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 etc/debian/cron.weekly-ashd 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 -- 2.11.0