Created
February 23, 2020 06:15
-
-
Save shirish87/fd9b1297036bdf122aeb135fa8af09ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
dest="$(date '+%Y-%m-%d')-snapshot" | |
container="${1:-influxdb-1}" | |
db="${2:-comp_prices}" | |
destpath="/tmp/${dest}" | |
destfile="/tmp/${dest}.tgz" | |
docker exec -it $container influxd backup -portable -database $db "$destpath" | |
docker exec -it $container tar -czf "$destfile" "$destpath" | |
docker cp "$container:$destfile" . | |
docker exec -it $container rm -rf "$destpath" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment