Skip to content

Instantly share code, notes, and snippets.

@iods
Created November 28, 2015 02:02
Show Gist options
  • Save iods/7d20538e82fb94c49086 to your computer and use it in GitHub Desktop.
Save iods/7d20538e82fb94c49086 to your computer and use it in GitHub Desktop.
Remove Magento sessions (file stored) in a certain specified timeframe. Run through a cron job.
#!/bin/bash
# Remove Sessions older than specified time.
DIR=/var/www/magento/var/session/
RANGE=30
/usr/bin/find $DIR -depth -mtime +$RANGE -exec rm -rf '{}' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment