Delete/Refresh Cache files and Logs files, of Sarg and Squid

Several tutorials

Delete/Refresh Cache files and Logs files, of Sarg and Squid

Mensagempor Lelouch » Ter Nov 25, 2008 3:32 pm

Delete/Refresh files from Cache/Logs/Sarg of Squid
by EugenioNava Mon 24 Nov, 2008 13:57 pm
(Translated by rinrinrinrenacuajo)

I would like to greetings to everybody from venezuela.

After of my holiday, I am back to BrazilFW.

I am grateful to my friend Marcos do Vale for the responses to my concerns about Squid.

I will attach three (3) Scripts, very useful to use Squid Oficial in any version, and it work at same time with the Sarg as report manager, with the objective of automatize and hold a low cost in our hard disk.

The following list, show the paths and files with hight growing in our BFW server with the squid:

1.) /partition/squid/cache
2.) /partition/squid/logs
3.) /partition/web2/sarg


Scripts:

1.) Delete Cache

#!/bin/sh
#delete cache
# Ing. Eugenio Nava M.
# Version 0.1
# In a Terminal or you can too add it to the cron.

squid -k interrupt

echo "Reconstructing the Oficial Squid Cache...."

sleep 5

rm -Rf /partition/squid/cache/*

sync
sync
sync

#BFW 2.30.1 y BFW 2.31.10
sh /etc/rc.d/pkgs/rc.squid

backup squid

2.) Delete logs

#!/bin/sh
#delete logs
# Ing. Eugenio Nava M.
# Version 0.1
# In a Terminal or you can too add it to the cron.

cd /partition/squid/logs

squid -k rotate

rm -f /partition/squid/logs/*.0
rm -f /partition/squid/logs/*.1
rm -f /partition/squid/logs/*.2
rm -f /partition/squid/logs/*.3
rm -f /partition/squid/logs/*.4
rm -f /partition/squid/logs/*.5
rm -f /partition/squid/logs/*.6
rm -f /partition/squid/logs/*.7
rm -f /partition/squid/logs/*.8
rm -f /partition/squid/logs/*.9

3.) Delete sarg

#!/bin/sh
#Delete sarg
# Ing. Eugenio Nava M.
# Version 0.1
# In a Terminal or you can too add it to the cron.

echo "Reconstructing Oficial Sarg..."

cp /partition/web2/sarg/.htpasswd /partition/squid

rm -Rf /partition/web2/sarg/*

sync
sync
sync

cp /partition/squid/.htpasswd /partition/web2/sarg/

sarg

#BFW 2.30.1 y BFW 2.31.10
sh /etc/rc.d/pkgs/rc.squid

backup squid

Notes:

1.) These scripts can be converted into individual files to be included in the CRON, change the run frequency according to their needs.
2.) These Script let optimize the Hard disk cost in our BFW Server.
3.) These Script let delete and reconstruct the Oficial Squid Cache without interrupt the activities of BFW Server.

I'm waiting for comments.

Eugenio Nava
GNU/Linux addict, instead of Linux addict.
Sou, machigatteita no wa ore ja nai! Sekai no hou da!...
Sekai wa kawaru! Kaerareru...

Hangyaku no Rurūshu...

New scheme: BFW3(LB) - BFW3BridgeCache - ArgentoBridgeQoS
Avatar do usuário
Lelouch
BFW Beneméritos
 
Mensagens: 1324
Registrado em: Dom Out 05, 2008 7:39 pm
Localização: #!/bin/sh
BrazilFW Box: BrazilFW: RAM 3GB, ATHLON X2 5600+, HDD 160GB+120GB, LB: 2Mb+8Mb.
BFW3 BuildTree on GNU/Linux Archlinux 64 bits.

Voltar para Several tutorials

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 2 visitantes

cron