Clean Magento Logs

by dt on August 14th, 2011

A small shell script that search for magento databases and clean their logs:

#/bin/bash
for i in `find /var/lib/mysql/ | grep dataflow_batch_export | awk 'BEGIN { FS = "/" } ; { print $5 }'`; do
echo -n $i " ... "
mysql -e "TRUNCATE dataflow_batch_export; TRUNCATE dataflow_batch_import; TRUNCATE log_url_info; TRUNCATE log_visitor; TRUNCATE report_event; TRUNCATE log_visitor_info; TRUNCATE log_url; TRUNCATE log_quote;" $i
echo "[ DONE ]";
done

shorturl: