1. Backup your media/catalog
Create a manually backup of media/catalog without /cache/ folder
1 2 |
$ cd /var/www/{{{MAGENTO}}}/media/ $ tar -czf ~/catalog.tar.gz catalog --exclude 'catalog/product/cache/*' |
The same with the current date in the filename.
1 |
$ tar -czf ~/"catalog_$(date '+%Y%m%d').tar.gz" catalog --exclude 'catalog/product/cache/*' |
2. Files not owned by apache
Find files which are not owned by apache group or user. This is useful if you want detect possible permission issues.
1 2 |
$ cd /var/www/{{{MAGENTO}}}/ $ find . \! -group www-data \! -user www-data |
3. SQL / CSV files in your document root
You should never left database dump or other export files with sensible information in your document root, because there is a potential risk that those files can be downloaded from outside, depending on your security settings. To make sure your production environment is save, just run a simple ” find ” with the option ” iregex “.
1 2 |
$ cd /var/www/{{{MAGENTO}}}/ $ find -iregex '.*\.\(sql\|tar\|gz\|zip\|csv\)' |
4. List report files created in the last 24 hours
1 2 |
$ cd /var/www/{{{MAGENTO}}}/var/report/ $ find . -type f -ctime -1 |
Here are some more options you can use for ” -ctime “.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# find files created greater than 24 hours ago find . -type f -ctime +0 # find files created between now and 1 day ago # (i.e., in the past 24 hours only) find . -type f -ctime 0 # find files created less than 1 day ago find . -type f -ctime -1 # find files created between 24 and 48 hours ago find . -type f -ctime 1 # find files created more than 48 hours ago find . -type f -ctime +1 |
5. Truncate log files
A fast growing system.log or exception.log can be the cause of a server outage. If you want empty log files on a production environment, the command ” truncate ” will help you.
1 2 |
$ cd /var/www/{{{MAGENTO}}}/var/log $ truncate -s 0 system.log |
For further debugging you can keep log data by specifying the size.
1 |
$ truncate -s 10M system.log |