diff --git a/gestion/squid-logrotate-script.sh b/gestion/squid-logrotate-script.sh new file mode 100755 index 00000000..9bee75a1 --- /dev/null +++ b/gestion/squid-logrotate-script.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +umask 0177 + +logs_src=/var/log/squid +logs_dst=/home/squid/logs + +dernier_fichier=$(ls -tr "$logs_src" | grep access.log | head -1) + +timestamp=$(bzcat "$dernier_fichier" | head -1 | awk '{print $1}') + +date=$(date -d "1970-01-01 $timestamp sec" +"%Y-%m-%d") + +install -o root -g root -m 0400 -p "$dernier_fichier" "$logs_dst/access.log.$date.bz2" + +find "$logs_dst" -mtime +365 -delete