Single blog// see post details
Clean Magento log files
- 3939 Views
- /
- 0 Comments
- /
- in Informational, Server Admin, Web
- /
- by admin
Bash script to clean log files
This script is a must-have if you’re managing multiple magento websites. Log files can build up to multiple gigabytes. System resources will undoubtedly begin to suffer if you aren’t careful.
#!/bin/bash rm -rf /root/logs_cleaned.txt for MAGUSERS in `ls /var/cpanel/users`; do MAGDIR="/home/$MAGUSERS/public_html/shell/log.php" if [ -f "$MAGDIR" ]; then printf "$MAGUSERS\n"; printf "$MAGUSERS - " >> /root/logs_cleaned.txt; php -f /home/$MAGUSERS/www/shell/log.php clean >> /root/logs_cleaned.txt fi done; php /root/logs_cleaned_mail.php