Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
call bgsave and sleep 5 loop until lastsave changes upload backup rdb to S3
rediscli=`which redis-cli`
s3cmd=`which s3cmd`
lsave=`$rediscli lastsave`
echo "LASTSAVE $lsave"
saved="`$rediscli config get dir | xargs | cut -d ' ' -f 2`/`$rediscli config get dbfilename | xargs | cut -d ' ' -f 2`"
$rediscli bgsave
while [ $lsave -eq `$rediscli lastsave` ]; do
sleep 5
echo "LASTSAVE `$rediscli lastsave`"
echo "BGSAVE complete! ($saved)"
$s3cmd put $saved s3://$s3bucket/$s3filepath

This comment has been minimized.

Copy link

@ptaoussanis ptaoussanis commented Aug 16, 2013

This is great, thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.