sauvegardes/bin/dump-influx

20 lines
498 B
Plaintext
Raw Permalink Normal View History

2023-03-20 23:43:59 +01:00
#!/bin/bash
DUMP_DIR="/var/backups/dumps/"
mkdir -p "$DUMP_DIR"
chmod go-rwx "$DUMP_DIR"
if [ -x /usr/bin/influxd ]; then
DATABASES=$(influx --execute "show databases" | tail +4)
echo "Databases: $DATABASES"
for DATABASE in $DATABASES ; do
echo "Dumping database: $DATABASE"
rm -fr "${DUMP_DIR}/influx-${DATABASE}"
/usr/bin/influxd backup -portable -database $DATABASE -host localhost:8088 $DUMP_DIR/influx-$DATABASE
done
else
echo "DMBS Influx not detected."
fi