smeserver-samba-db-logd/root/etc/cron.daily/samba-db-cleanup

14 lines
425 B
Bash

#!/bin/bash
LOG=$(/sbin/e-smith/db configuration getprop samba-db-logd status || echo 'disabled')
if [ "$LOG" != "enabled" ]; then
exit 0
fi
RETENTION=$(/sbin/e-smith/db configuration getprop samba-db-logd Retention || echo 370)
DB=$(/sbin/e-smith/db configuration getprop samba-db-logd DbName || echo samba_log)
echo "delete from audit where date_day<DATE_SUB(NOW(), INTERVAL $RETENTION DAY);" | /usr/bin/mysql $DB