#! /bin/sh

# sysklogd Cron script to rotate system log files weekly.
#
#  If you want to rotate logfiles daily, edit
#  this script and /etc/cron.daily/sysklogd to get
#  the logfiles in sync (they must not occur in both
#  files).
#
#  This is a configration file.  You are invited to edit
#  it and maintain it on your own.  You'll have to do
#  that if you don't like the default policy
#  wrt. rotating logfiles (i.e. with large logfiles
#  weekly and daily rotation may interfere).  If you edit
#  this file and don't let dpkg upgrade it, you have full
#  control over it.  Please read the manpage to
#  syslogd-listfiles.
#
#  Written by Ian A. Murdock <imurdock@debian.org>.
#  $Id: cron.weekly,v 1.9 2003/10/02 17:51:29 joey Exp $
###############################################################################################
# Archivo /etc/cron.weekly/sysklogd modificado el da 12 de Mayo de 2005.
# Instalado en los centros Guadalinfo 2004 accedidos va ssh en el periodo Mayo-Junio 2005
# Corrige error en rotacin semanal de los ficheros auth.log.
# Autor: Rafael Martn (Emergya)
# Aprobado: Alberto Ruiz (SADESI)
###############################################################################################




test -x /usr/sbin/syslogd-listfiles || exit 0
test -x /sbin/syslogd || exit 0
test -d /usr/share/doc/sysklogd || exit 0

set -e

cd /var/log
# Modificacin para que no se rote el fichero de sesiones de manera automtica
#for LOG in `syslogd-listfiles --weekly `
for LOG in `syslogd-listfiles --weekly | grep -v "auth"`
do
   if [ -s $LOG ]; then
      savelog -g adm -m 640 -u root -c 4 $LOG >/dev/null
   fi
done

# Restart syslogd
#
/etc/init.d/sysklogd reload-or-restart > /dev/null
