Tag - rethinkdb

Entries feed

Sunday, October 30 2016

Rotated backups for RethinkDB

Very simple bash script to rotate the backups (dumps) of RethinkDB:

#!/bin/bash
# DAILY BACKUPS
# Delete daily backups DAYS_TO_KEEP days old or more
# Config
BACKUP_DIR=/var/backups/rethinkdb/
DAYS_TO_KEEP=7
# Actions
find $BACKUP_DIR -maxdepth 1 -mtime +$DAYS_TO_KEEP -name "rethinkdb_dump_*" -exec rm -rf '{}' ';'
cd $BACKUP_DIR
rethinkdb dump

This assumes rethinkdb python utilities have been installed with:

pip install rethinkdb