Commit 394aa095 authored by Antoine Durand-Gasselin's avatar Antoine Durand-Gasselin
Browse files

[] le script effectue aussi du nettoyage

parent 264f35fc
umask 0177
dernier_fichier=$logs_src/$(ls -tr "$logs_src" | grep access.log | head -1)
while ( ls -tr "$logs_src" | grep -E 'access\.log\.[0-9]+\..z2?' ); do
dernier_fichier=$logs_src/$(ls -tr "$logs_src" | grep -E 'access\.log\.[0-9]+\..z2?' | 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"
echo mv "$dernier_fichier" "$logs_dst/access.log.$date.bz2"
echo chown root:root "$logs_dst/access.log.$date.bz2"
echo chmod 400 "$logs_dst/access.log.$date.bz2"
mv "$dernier_fichier" "$logs_dst/access.log.$date.bz2"
chown root:root "$logs_dst/access.log.$date.bz2"
chmod 400 "$logs_dst/access.log.$date.bz2"
#find "$logs_dst" -mtime +365 -delete
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment