Remove default backup dir and do not create backup folder automatically
Fails if the backup folder does not exist or is not writable.
This commit is contained in:
@@ -57,7 +57,7 @@ LOG_PATH='';
|
||||
# base path for PostgreSQL binary
|
||||
# DBPATH_BASE='';
|
||||
# defaults
|
||||
_BACKUPDIR='/mnt/backup/db_dumps_fc/';
|
||||
_BACKUPDIR='';
|
||||
_DB_VERSION=$(
|
||||
pgv=$(
|
||||
pg_dump --version | grep "pg_dump" | cut -d " " -f 3
|
||||
@@ -324,11 +324,10 @@ if [ ! -f "${PG_PSQL}" ] || [ ! -f "${PG_DUMP}" ] || [ ! -f "${PG_DUMPALL}" ]; t
|
||||
exit 0;
|
||||
fi;
|
||||
|
||||
if [ ! -d "${BACKUPDIR}" ] ; then
|
||||
if ! mkdir "${BACKUPDIR}" ; then
|
||||
echo "Cannot create backup directory: ${BACKUPDIR}"
|
||||
# not directory or length is zero
|
||||
if [ ! -d "${BACKUPDIR}" ] || [ -z "${BACKUPDIR}" ]; then
|
||||
echo "Backup directory does not exist: ${BACKUPDIR}";
|
||||
exit 0;
|
||||
fi
|
||||
fi
|
||||
# check if we can write into that folder
|
||||
touch "${BACKUPDIR}/tmpfile" || echo "[!] touch failed";
|
||||
@@ -336,7 +335,7 @@ if [ ! -f "${BACKUPDIR}/tmpfile" ]; then
|
||||
echo "Cannot write to ${BACKUPDIR}";
|
||||
exit 0;
|
||||
else
|
||||
rm -f "${BACKUPDIR}/tmpfile";
|
||||
rm "${BACKUPDIR}/tmpfile";
|
||||
fi;
|
||||
# if backupdir is "." rewrite to pwd
|
||||
if [ "${BACKUPDIR}" == '.' ]; then
|
||||
|
||||
Reference in New Issue
Block a user