Remove date from DB backups
This commit is contained in:
parent
bb5bbf16f5
commit
9296c88ae4
1 changed files with 3 additions and 4 deletions
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DATE=$(date -I)
|
|
||||||
BACKUP_DIR=$1
|
BACKUP_DIR=$1
|
||||||
|
|
||||||
if [ -z "$BACKUP_DIR" ]
|
if [ -z "$BACKUP_DIR" ]
|
||||||
|
@ -21,13 +20,13 @@ do
|
||||||
"mariadb")
|
"mariadb")
|
||||||
db_name=$(docker exec $container_id bash -c 'echo $MYSQL_USER')
|
db_name=$(docker exec $container_id bash -c 'echo $MYSQL_USER')
|
||||||
echo Backing up mariadb $db_name
|
echo Backing up mariadb $db_name
|
||||||
docker exec $container_id bash -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD --all-databases' | pv > $BACKUP_DIR/$db_name-$DATE.sql
|
docker exec $container_id bash -c 'mysqldump -u $MYSQL_USER -p$MYSQL_PASSWORD --all-databases' | pv > $BACKUP_DIR/$db_name.sql
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"postgres")
|
"postgres")
|
||||||
db_name=$(docker exec $container_id bash -c 'echo $POSTGRES_USER')
|
db_name=$(docker exec $container_id bash -c 'echo $POSTGRES_USER')
|
||||||
echo Backing up postgres $db_name
|
echo Backing up postgres $db_name
|
||||||
docker exec $container_id bash -c 'PGPASSWORD=$POSTGRES_PASSWORD pg_dumpall -U $POSTGRES_USER' | pv > $BACKUP_DIR/$db_name-$DATE.sql
|
docker exec $container_id bash -c 'PGPASSWORD=$POSTGRES_PASSWORD pg_dumpall -U $POSTGRES_USER' | pv > $BACKUP_DIR/$db_name.sql
|
||||||
;;
|
;;
|
||||||
"yandex/clickhouse-server")
|
"yandex/clickhouse-server")
|
||||||
# Hardcode for plausible
|
# Hardcode for plausible
|
||||||
|
@ -35,7 +34,7 @@ do
|
||||||
for table in $tables
|
for table in $tables
|
||||||
do
|
do
|
||||||
echo Backing up clickhouse table $table
|
echo Backing up clickhouse table $table
|
||||||
docker exec $container_id clickhouse-client --query "SELECT * FROM plausible.$table" --format CSVWithNames | pv > $BACKUP_DIR/plausible-$table-$DATE.csv
|
docker exec $container_id clickhouse-client --query "SELECT * FROM plausible.$table" --format CSVWithNames | pv > $BACKUP_DIR/plausible-$table.csv
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue