mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 07:03:54 +01:00
Added remote dir creation before file backup.
This commit is contained in:
parent
60b3d4674e
commit
da043ed3ae
@ -6,7 +6,7 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2015111801
|
PROGRAM_BUILD=2015111901
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
FUNC_BUILD=2015111601
|
FUNC_BUILD=2015111601
|
||||||
@ -1313,7 +1313,7 @@ function GetDirectoriesSize {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CreateStorageDirsLocal {
|
function _CreateDirectoryLocal {
|
||||||
local dir_to_create="${1}"
|
local dir_to_create="${1}"
|
||||||
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
@ -1330,7 +1330,7 @@ function _CreateStorageDirsLocal {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CreateStorageDirsRemote {
|
function _CreateDirectoryRemote {
|
||||||
local dir_to_create="${1}"
|
local dir_to_create="${1}"
|
||||||
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
@ -1352,26 +1352,26 @@ function CreateStorageDirectories {
|
|||||||
|
|
||||||
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then
|
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then
|
||||||
if [ "$SQL_BACKUP" != "no" ]; then
|
if [ "$SQL_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsLocal "$SQL_STORAGE"
|
_CreateDirectoryLocal "$SQL_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_SQL=0
|
CAN_BACKUP_SQL=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$FILE_BACKUP" != "no" ]; then
|
if [ "$FILE_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsLocal "$FILE_STORAGE"
|
_CreateDirectoryLocal "$FILE_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_FILES=0
|
CAN_BACKUP_FILES=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
if [ "$SQL_BACKUP" != "no" ]; then
|
if [ "$SQL_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsRemote "$SQL_STORAGE"
|
_CreateDirectoryRemote "$SQL_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_SQL=0
|
CAN_BACKUP_SQL=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$FILE_BACKUP" != "no" ]; then
|
if [ "$FILE_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsRemote "$FILE_STORAGE"
|
_CreateDirectoryRemote "$FILE_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_FILES=0
|
CAN_BACKUP_FILES=0
|
||||||
fi
|
fi
|
||||||
@ -1650,25 +1650,19 @@ function Rsync {
|
|||||||
RSYNC_NO_RECURSE_ARGS=""
|
RSYNC_NO_RECURSE_ARGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO : add remote directory creation
|
# Creating subdirectories because rsync cannot handle multiple subdirectory creation
|
||||||
# Creating subdirectories because rsync cannot handle mkdir -p
|
|
||||||
if [ ! -d "$file_storage_path/$backup_directory" ]; then
|
|
||||||
# no sudo here
|
|
||||||
mkdir -p "$file_storage_path/$backup_directory"
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
Logger "Cannot create storage path [$file_storage_path/$backup_directory]." "ERROR"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BACKUP_TYPE" == "local" ]; then
|
if [ "$BACKUP_TYPE" == "local" ]; then
|
||||||
|
_CreateDirectoryLocal "$file_storage_path/$backup_directory"
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
||||||
|
_CreateDirectoryLocal "$file_storage_path/$backup_directory"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
|
_CreateDirectoryRemote "$file_storage_path/$backup_directory"
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2015111801
|
PROGRAM_BUILD=2015111901
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
source "/home/git/common/ofunctions.sh"
|
source "/home/git/common/ofunctions.sh"
|
||||||
@ -427,7 +427,7 @@ function GetDirectoriesSize {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CreateStorageDirsLocal {
|
function _CreateDirectoryLocal {
|
||||||
local dir_to_create="${1}"
|
local dir_to_create="${1}"
|
||||||
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ function _CreateStorageDirsLocal {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CreateStorageDirsRemote {
|
function _CreateDirectoryRemote {
|
||||||
local dir_to_create="${1}"
|
local dir_to_create="${1}"
|
||||||
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 1 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
@ -466,26 +466,26 @@ function CreateStorageDirectories {
|
|||||||
|
|
||||||
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then
|
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then
|
||||||
if [ "$SQL_BACKUP" != "no" ]; then
|
if [ "$SQL_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsLocal "$SQL_STORAGE"
|
_CreateDirectoryLocal "$SQL_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_SQL=0
|
CAN_BACKUP_SQL=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$FILE_BACKUP" != "no" ]; then
|
if [ "$FILE_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsLocal "$FILE_STORAGE"
|
_CreateDirectoryLocal "$FILE_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_FILES=0
|
CAN_BACKUP_FILES=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
if [ "$SQL_BACKUP" != "no" ]; then
|
if [ "$SQL_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsRemote "$SQL_STORAGE"
|
_CreateDirectoryRemote "$SQL_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_SQL=0
|
CAN_BACKUP_SQL=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$FILE_BACKUP" != "no" ]; then
|
if [ "$FILE_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsRemote "$FILE_STORAGE"
|
_CreateDirectoryRemote "$FILE_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_FILES=0
|
CAN_BACKUP_FILES=0
|
||||||
fi
|
fi
|
||||||
@ -764,25 +764,19 @@ function Rsync {
|
|||||||
RSYNC_NO_RECURSE_ARGS=""
|
RSYNC_NO_RECURSE_ARGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO : add remote directory creation
|
# Creating subdirectories because rsync cannot handle multiple subdirectory creation
|
||||||
# Creating subdirectories because rsync cannot handle mkdir -p
|
|
||||||
if [ ! -d "$file_storage_path/$backup_directory" ]; then
|
|
||||||
# no sudo here
|
|
||||||
mkdir -p "$file_storage_path/$backup_directory"
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
Logger "Cannot create storage path [$file_storage_path/$backup_directory]." "ERROR"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BACKUP_TYPE" == "local" ]; then
|
if [ "$BACKUP_TYPE" == "local" ]; then
|
||||||
|
_CreateDirectoryLocal "$file_storage_path/$backup_directory"
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
||||||
|
_CreateDirectoryLocal "$file_storage_path/$backup_directory"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
|
_CreateDirectoryRemote "$file_storage_path/$backup_directory"
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
28
obackup.sh
28
obackup.sh
@ -6,7 +6,7 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
AUTHOR="(L) 2013-2015 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2015111801
|
PROGRAM_BUILD=2015111901
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
FUNC_BUILD=2015111601
|
FUNC_BUILD=2015111601
|
||||||
@ -1201,7 +1201,7 @@ function GetDirectoriesSize {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CreateStorageDirsLocal {
|
function _CreateDirectoryLocal {
|
||||||
local dir_to_create="${1}"
|
local dir_to_create="${1}"
|
||||||
|
|
||||||
if [ ! -d "$dir_to_create" ]; then
|
if [ ! -d "$dir_to_create" ]; then
|
||||||
@ -1217,7 +1217,7 @@ function _CreateStorageDirsLocal {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _CreateStorageDirsRemote {
|
function _CreateDirectoryRemote {
|
||||||
local dir_to_create="${1}"
|
local dir_to_create="${1}"
|
||||||
|
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
@ -1237,26 +1237,26 @@ function CreateStorageDirectories {
|
|||||||
|
|
||||||
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then
|
if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then
|
||||||
if [ "$SQL_BACKUP" != "no" ]; then
|
if [ "$SQL_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsLocal "$SQL_STORAGE"
|
_CreateDirectoryLocal "$SQL_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_SQL=0
|
CAN_BACKUP_SQL=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$FILE_BACKUP" != "no" ]; then
|
if [ "$FILE_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsLocal "$FILE_STORAGE"
|
_CreateDirectoryLocal "$FILE_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_FILES=0
|
CAN_BACKUP_FILES=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
if [ "$SQL_BACKUP" != "no" ]; then
|
if [ "$SQL_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsRemote "$SQL_STORAGE"
|
_CreateDirectoryRemote "$SQL_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_SQL=0
|
CAN_BACKUP_SQL=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$FILE_BACKUP" != "no" ]; then
|
if [ "$FILE_BACKUP" != "no" ]; then
|
||||||
_CreateStorageDirsRemote "$FILE_STORAGE"
|
_CreateDirectoryRemote "$FILE_STORAGE"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
CAN_BACKUP_FILES=0
|
CAN_BACKUP_FILES=0
|
||||||
fi
|
fi
|
||||||
@ -1526,25 +1526,19 @@ function Rsync {
|
|||||||
RSYNC_NO_RECURSE_ARGS=""
|
RSYNC_NO_RECURSE_ARGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO : add remote directory creation
|
# Creating subdirectories because rsync cannot handle multiple subdirectory creation
|
||||||
# Creating subdirectories because rsync cannot handle mkdir -p
|
|
||||||
if [ ! -d "$file_storage_path/$backup_directory" ]; then
|
|
||||||
# no sudo here
|
|
||||||
mkdir -p "$file_storage_path/$backup_directory"
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
Logger "Cannot create storage path [$file_storage_path/$backup_directory]." "ERROR"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BACKUP_TYPE" == "local" ]; then
|
if [ "$BACKUP_TYPE" == "local" ]; then
|
||||||
|
_CreateDirectoryLocal "$file_storage_path/$backup_directory"
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" \"$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
elif [ "$BACKUP_TYPE" == "pull" ]; then
|
||||||
|
_CreateDirectoryLocal "$file_storage_path/$backup_directory"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$backup_directory\" \"$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
|
_CreateDirectoryRemote "$file_storage_path/$backup_directory"
|
||||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) $RSYNC_ARGS $RSYNC_NO_RECURSE_ARGS --stats $RSYNC_DELETE $RSYNC_EXCLUDE --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$backup_directory\" \"$REMOTE_USER@$REMOTE_HOST:$file_storage_path\" > $RUN_DIR/$PROGRAM.$FUNCNAME.$SCRIPT_PID 2>&1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user