feat: add postgres backup option
This commit is contained in:
parent
64bf6cc38f
commit
0852cb8c00
@ -1,6 +1,6 @@
|
|||||||
FROM debian
|
FROM debian
|
||||||
|
|
||||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget lftp mariadb-client
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget lftp mariadb-client postgresql-client
|
||||||
|
|
||||||
ARG CLIENT_VERSION
|
ARG CLIENT_VERSION
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
BACKUP_DIR="/backup/database"
|
BACKUP_DIR="/backup/database"
|
||||||
|
|
||||||
echo "Starting to backup database"
|
echo "Starting to backup mysql database"
|
||||||
|
|
||||||
mkdir --parents $BACKUP_DIR
|
mkdir --parents $BACKUP_DIR
|
||||||
mysqldump --single-transaction --host=$MYSQL_BACKUP_HOST --user=$MYSQL_BACKUP_USER --password=$MYSQL_BACKUP_PASSWORD $MYSQL_BACKUP_DATABASE > $BACKUP_DIR/$MYSQL_BACKUP_DATABASE.sqldump
|
mysqldump --single-transaction --host=$MYSQL_BACKUP_HOST --user=$MYSQL_BACKUP_USER --password=$MYSQL_BACKUP_PASSWORD $MYSQL_BACKUP_DATABASE > $BACKUP_DIR/$MYSQL_BACKUP_DATABASE.sqldump
|
||||||
|
|
||||||
echo "Database backup finished"
|
echo "Mysql database backup finished"
|
||||||
|
10
scripts/postgres_backup.sh
Normal file
10
scripts/postgres_backup.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
BACKUP_DIR="/backup/database"
|
||||||
|
|
||||||
|
echo "Starting to backup postgres database"
|
||||||
|
|
||||||
|
mkdir --parents $BACKUP_DIR
|
||||||
|
PGPASSWORD=$PG_PASSWORD pg_dump --host=$PG_HOST --username=$PG_USER $PG_DATABASE > $BACKUP_DIR/$PG_DATABASE.sqldump
|
||||||
|
|
||||||
|
echo "Postgres database backup finished"
|
@ -7,3 +7,7 @@ fi
|
|||||||
if [[ -n "$DO_MYSQL_BACKUP" ]]; then
|
if [[ -n "$DO_MYSQL_BACKUP" ]]; then
|
||||||
sh /usr/local/etc/urbackup/mysql_backup.sh
|
sh /usr/local/etc/urbackup/mysql_backup.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$DO_POSTGRES_BACKUP" ]]; then
|
||||||
|
sh /usr/local/etc/urbackup/postgres_backup.sh
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user