Redis backup file daily

  |   0 评论   |   181 浏览

#!/bin/bash
# ip: 10.129.1.68
# data dir : /data/solution/redis/data/
# backup dir : /data/redis_bak/

DATA_DIR="/data/solution/redis/data/"
BACKUP_DIR="/data/redis_bak/"

cd /data/solution/redis/
tar -czf redis_bak_`date +%F`.tgz ./data/ >/dev/null 2>&1
mv redis_bak_`date +%F`.tgz $BACKUP_DIR

# keep backup files for 30 days
find $BACKUP_DIR -type f -mtime +30 -name '*.tgz' -print0 | xargs -0 /bin/rm -f

# crontab -e
# * 3 * * * /bin/bash /data/solution/redis/redis_backup.sh


标题:Redis backup file daily
作者:SmiteLi
地址:https://smite.site/articles/2019/09/12/1568255347994.html

评论

发表评论