initial commit of file from CVS for smeserver-webfilter on Sat Sep 7 16:44:31 AEST 2024
This commit is contained in:
22
root/etc/cron.daily/squid-db-cleanup
Normal file
22
root/etc/cron.daily/squid-db-cleanup
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
HOME=/root
|
||||
|
||||
LOG=$(/sbin/e-smith/db configuration getprop squid-db-logd status || echo 'disabled')
|
||||
|
||||
if [ "$LOG" != "enabled" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HOST=$(/sbin/e-smith/db configuration getprop squid-db-logd DbHost || echo 'localhost')
|
||||
|
||||
if [ "$HOST" != "localhost" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RETENTION=$(/sbin/e-smith/db configuration getprop squid-db-logd Retention || echo 370)
|
||||
DB=$(/sbin/e-smith/db configuration getprop squid-db-logd DbName || echo squid_log)
|
||||
|
||||
echo "delete from access_log where date_day<DATE_SUB(NOW(), INTERVAL $RETENTION DAY);" | /usr/bin/mysql $DB
|
||||
echo "delete from deny_log where date_day<DATE_SUB(NOW(), INTERVAL $RETENTION DAY);" | /usr/bin/mysql $DB
|
||||
|
||||
Reference in New Issue
Block a user