How to delete Magento session_ files older than 30 days with cron

Manual command (in screen)
find /home/the-d2.com/public_html/var/session/ -type f -name "sess*" -mtime +30 -exec rm -f {} \; >/dev/null 2>&1
Cron
0 0 * * * find /home/the-d2.com/public_html/var/session/ -type f -name "sess*" -mtime +30 -exec rm -f {} \; >/dev/null 2>&1

Leave a Reply