Skip to content

Instantly share code, notes, and snippets.

@bicccio
Forked from zlove/crontab
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bicccio/1f7690862cd2ce4c0590 to your computer and use it in GitHub Desktop.
Save bicccio/1f7690862cd2ce4c0590 to your computer and use it in GitHub Desktop.
Crontab entry to clean up the Magento sessions directory. Edit php.ini and change session.gc_maxlifetime to adjust how long session data is kept around. From http://stackoverflow.com/a/9631312/186136
0 2 * * * /usr/bin/find /FIXME/PATH/TO/DOMAIN.COM/var/session -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 -exec rm {} \; >/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment