Skip to content

Instantly share code, notes, and snippets.

@twstokes
Last active April 18, 2017 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twstokes/f7062412fef196a9a1b0917a7c6e9882 to your computer and use it in GitHub Desktop.
Save twstokes/f7062412fef196a9a1b0917a7c6e9882 to your computer and use it in GitHub Desktop.
InfluxDB Docker backups
#!/bin/bash
mkdir ./backups
dbs=( "_internal" "telegraf" "health" "nodemcu" "sensors" )
for db in "${dbs[@]}"
do
docker run --rm -v $PWD/backups:/backups influxdb influxd backup -database $db -host influx-hostname:8088 /backups/$db
done
date=`date "+%Y-%m-%d-%H:%M:%S"`
tar -cvf ./"influx_backup-${date}.tar" ./backups
rm -rf ./backups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment