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