Script de déplacement des logs de squid dans /home (fait par Nicolas)
darcs-hash:20071025231032-68412-33ec449a7c01d93ff3b24190f62bd5b28765e725.gz
This commit is contained in:
parent
a5043042ab
commit
8eacbc3b6b
1 changed files with 16 additions and 0 deletions
16
gestion/squid-logrotate-script.sh
Executable file
16
gestion/squid-logrotate-script.sh
Executable file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue