Pfsense – Squid Cache leeren mit Script und Cron

Erstelle dazu ein Scripts /sbin/cleansquid.sh mit folgendem Inhalt:

#Stop Squid-Monitor
ps -f | grep “proxy_monitor.sh” | awk ‘{print $1}’ | xargs kill -9
#Stop Squid-Proxy
/usr/local/etc/rc.d/squid.sh stop
#CleanUp Squid-Cache
rm -rf /var/squid/cache/*
#Rebuild Squid-Cache
/usr/local/sbin/squid -z
wait $!
#Start Squid-Proxy
/usr/local/etc/rc.d/squid.sh start
#Start Squid-Monitor
nohup sh /usr/local/etc/rc.d/proxy_monitor.sh start &

Erstellen des Croneintrages, in diesem Beispiel jeden Freitag, 12:00 Uhr:

0      12      *      *      5      root      sh /sbin/cleansquid.sh

Schreibe einen Kommentar