feat: fail backup on script errors
parent
a02735d982
commit
ede6cd537e
|
@ -11,7 +11,7 @@ lftp -u "$FTP_USER","$FTP_PASSWORD" $FTP_HOST <<EOF
|
|||
set ssl:verify-certificate no
|
||||
mirror --delete --parallel=4 --use-pget-n=10 $REMOTE_DIR $LOCAL_DIR;
|
||||
exit
|
||||
EOF
|
||||
EOF || exit 1
|
||||
echo
|
||||
echo "Transfer finished"
|
||||
date
|
||||
|
|
|
@ -4,7 +4,7 @@ BACKUP_DIR="/backup/database"
|
|||
|
||||
echo "Starting to backup mysql database"
|
||||
|
||||
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
|
||||
mkdir --parents $BACKUP_DIR || exit 1
|
||||
mysqldump --single-transaction --host=$MYSQL_BACKUP_HOST --user=$MYSQL_BACKUP_USER --password=$MYSQL_BACKUP_PASSWORD $MYSQL_BACKUP_DATABASE > $BACKUP_DIR/$MYSQL_BACKUP_DATABASE.sqldump || exit 1
|
||||
|
||||
echo "Mysql database backup finished"
|
||||
|
|
|
@ -4,7 +4,7 @@ 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
|
||||
mkdir --parents $BACKUP_DIR || exit 1
|
||||
PGPASSWORD=$PG_PASSWORD pg_dump --host=$PG_HOST --username=$PG_USER $PG_DATABASE > $BACKUP_DIR/$PG_DATABASE.sqldump || exit 1
|
||||
|
||||
echo "Postgres database backup finished"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
if [[ -n "$DO_FTP_BACKUP" ]]; then
|
||||
sh /usr/local/etc/urbackup/ftp_backup.sh
|
||||
sh /usr/local/etc/urbackup/ftp_backup.sh || exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$DO_MYSQL_BACKUP" ]]; then
|
||||
sh /usr/local/etc/urbackup/mysql_backup.sh
|
||||
sh /usr/local/etc/urbackup/mysql_backup.sh || exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$DO_POSTGRES_BACKUP" ]]; then
|
||||
sh /usr/local/etc/urbackup/postgres_backup.sh
|
||||
sh /usr/local/etc/urbackup/postgres_backup.sh || exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue