Skip to content

Instantly share code, notes, and snippets.

@mklooss
Created November 19, 2012 10:33
Show Gist options
  • Save mklooss/4110023 to your computer and use it in GitHub Desktop.
Save mklooss/4110023 to your computer and use it in GitHub Desktop.
Magento/Shopware DevServer remove Old files
#!/bin/bash
echo "delete: Old Log Files"
if [ -d /var/customers/logs ]; then
touch /var/customers/logs
/usr/bin/find /var/customers/logs/ -depth -mtime +7 -exec rm '{}' \;
fi
SEARCH_DIR=/var/customers/webs
for web in $SEARCH_DIR/*; do
BASENAME=`basename $web`
# magento
if [ -d "$web/var/cache" ]; then
touch "$web/var/cache/"
/usr/bin/find "$web/var/cache/" -depth -mtime +7 -exec rm -r '{}' \;
fi
if [ -d "$web/var/session" ]; then
touch "$web/var/session"
/usr/bin/find "$web/var/session/" -depth -mtime +7 -exec rm -r '{}' \;
fi
if [ -d "$web/var/full_page_cache" ]; then
touch "$web/var/full_page_cache"
/usr/bin/find "$web/var/full_page_cache/" -depth -mtime +7 -exec rm -r '{}' \;
fi
if [ -d "$web/media/tmp" ]; then
touch "$web/media/tmp"
/usr/bin/find "$web/media/tmp/" -depth -mtime +7 -exec rm -r '{}' \;
fi
if [ -d "$web/var/report" ]; then
touch "$web/var/report/"
/usr/bin/find "$web/var/report/" -depth -mtime +7 -exec rm -r '{}' \;
fi
# shopware
if [ -d "$web/cache/database" ]; then
touch "$web/cache/database/"
/usr/bin/find "$web/cache/database/" -depth -mtime +7 -exec rm -r '{}' \;
fi
if [ -d "$web/cache/templates" ]; then
touch "$web/cache/templates"
/usr/bin/find "$web/cache/templates/" -depth -mtime +7 -exec rm -r '{}' \;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment