Added sample custom log and CDR rotator script.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4593 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-09-09 16:09:57 +00:00
parent 32ba130367
commit 50658629b1
1 changed files with 19 additions and 0 deletions

19
tools/log_rotate.sh Executable file
View File

@ -0,0 +1,19 @@
#! /bin/sh
# Sample log and CDR rotator that creates files based on date and hour
# Assumes Yate writes to /var/log/yate and /var/log/yate-cdr.tsv
# You can place this script in /etc/cron.hourly and not use the system logrotate
# NOTE: Files are never deleted! Periodic cleanup is required
base="/var/log"
old="$base/yate-old"
ym=`date '+%Y-%m'`
d=`date '+%d'`
h=`date '+%H'`
mkdir -p "$old/$ym/$d"
mv "$base/yate" "$old/$ym/yate-$d-$h.log"
mv "$base/yate-cdr.tsv" "$old/$ym/$d/yate-cdr-$h.tsv"
/bin/kill -HUP `/bin/cat /var/run/yate.pid`