20 lines
498 B
Bash
Executable File
20 lines
498 B
Bash
Executable File
#!/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
|