Skip to content

Instantly share code, notes, and snippets.

@v-thomp4
Forked from SebastienElet/redis-backup.sh
Created July 28, 2014 04:14
Show Gist options
  • Save v-thomp4/678589e9653c2cc8bf98 to your computer and use it in GitHub Desktop.
Save v-thomp4/678589e9653c2cc8bf98 to your computer and use it in GitHub Desktop.
#!/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