Skip to content

Instantly share code, notes, and snippets.

@zlove
Last active July 6, 2021 05:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save zlove/8876096 to your computer and use it in GitHub Desktop.
Save zlove/8876096 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