Rotated backups for RethinkDB
By Pierre-Alain B on Sunday, October 30 2016, 04:05 - Permalink
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