host=`ifconfig eth1 | grep -w inet | awk '{ print $2 }' | awk -F: '{ print $2 }'`
PORTS=(6309 6319 7309 7319 7329 7339)
bakdate=`date +"%Y%m%d"`
backpath=/home/backup/redis/$bakdate/
mkdir -p $backpath
for port in ${PORTS[@]};do
echo `redis-cli -h $host -p $port CONFIG SET dbfilename dump$port.rdb`
echo `redis-cli -h $host -p $port bgsave`
sleep 60
cd /home/redis/
tar zcvf dump$port.tar.gz dump$port.rdb
mv dump$port.tar.gz $backpath
done
find $backpath -mtime +15 -name "*.gz" -exec rm {} \;