14
14
# for details, see http://www.debian.org/doc/debian-policy/ or
15
15
# the debian-policy package
17
rotate_old_log_files()
19
log_files="syslog mail.info mail.warn mail.err mail.log daemon.log \
20
kern.log auth.log user.log lpr.log cron.log debug messages"
24
for f in $log_files; do
25
if [ -e $dir/$f.0 ]; then
27
if [ -e $dir/$f.1.gz ]; then
28
date0=$(stat --format=%Y $dir/$f.0)
29
date1=$(stat --format=%Y $dir/$f.1.gz)
30
if [ $date0 -lt $date1 ] ; then
31
# .0 log file is older than .1
32
skipped_files="$dir/$f.0\n$skipped_files"
36
if [ "$rotate" = "yes" ] ; then
37
for s in $(seq 9 -1 1) ; do
38
if [ -e $dir/$f.$s.gz ]; then
39
mv $dir/$f.$s.gz $dir/$f.$(($s+1)).gz
42
mv $dir/$f.0 $dir/$f.1
46
if [ -n "$skipped_files" ]; then
47
printf "The following old log files were found which could not be rotated safely.\n"
48
printf "\n$skipped_files\n"
49
printf "Please inspect them manually and delete them, if no longer required.\n"
56
# Rotate .0 log files when migrating from sysklogd
57
if dpkg --compare-versions "$2" lt "3.18.5-1"; then
61
20
user_conf=/etc/rsyslog.d/50-default.conf
62
21
default_conf=/usr/share/rsyslog/50-default.conf