Skip to content

Instantly share code, notes, and snippets.

@SebastienElet
Last active August 29, 2015 14:02
Show Gist options
  • Save SebastienElet/6c2de6e3f85ef5e22c74 to your computer and use it in GitHub Desktop.
Save SebastienElet/6c2de6e3f85ef5e22c74 to your computer and use it in GitHub Desktop.
redis-backup.sh
#!/bin/bash
BACKUP=/home/backups/redis
REDIS_SOURCE=/var/lib/redis/dump.rdb
REDIS_DEST=$BACKUP/$(date +"%Y-%m-%d")-dump.rdb
find $BACKUP/* -name "*.rdb" -mtime +7 -exec rm {} \;
redis-cli save > /dev/null
cp $REDIS_SOURCE $REDIS_DEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment