mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 15:13:53 +01:00
Begin code rewrite
This commit is contained in:
parent
8828a21741
commit
69d1729b2e
@ -4,7 +4,7 @@
|
|||||||
PROGRAM="obackup"
|
PROGRAM="obackup"
|
||||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2016 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
|
PROGRAM_VERSION=2.0-dev
|
||||||
PROGRAM_BUILD=2016080602
|
PROGRAM_BUILD=2016080602
|
||||||
IS_STABLE=yes
|
IS_STABLE=yes
|
||||||
|
|
||||||
@ -285,11 +285,16 @@ function _ListRecursiveBackupDirectoriesLocal {
|
|||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
local cmd
|
local cmd
|
||||||
|
local directories
|
||||||
|
local directory
|
||||||
|
local retval
|
||||||
|
|
||||||
OLD_IFS=$IFS
|
IFS=$PATH_SEPARATOR_CHAR read -a directories <<< "$RECURSIVE_DIRECTORY_LIST"
|
||||||
IFS=$PATH_SEPARATOR_CHAR
|
#OLD_IFS=$IFS
|
||||||
for directory in $RECURSIVE_DIRECTORY_LIST
|
#IFS=$PATH_SEPARATOR_CHAR
|
||||||
do
|
#TODO CHECK THIS
|
||||||
|
#for directory in $RECURSIVE_DIRECTORY_LIST
|
||||||
|
for directory in "${directories[@]}"; do
|
||||||
# No sudo here, assuming you should have all necessary rights for local checks
|
# No sudo here, assuming you should have all necessary rights for local checks
|
||||||
cmd="$FIND_CMD -L $directory/ -mindepth 1 -maxdepth 1 -type d >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID 2> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID"
|
cmd="$FIND_CMD -L $directory/ -mindepth 1 -maxdepth 1 -type d >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID 2> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID"
|
||||||
Logger "cmd: $cmd" "DEBUG"
|
Logger "cmd: $cmd" "DEBUG"
|
||||||
@ -308,7 +313,7 @@ function _ListRecursiveBackupDirectoriesLocal {
|
|||||||
retval=0
|
retval=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS=$OLD_IFS
|
#IFS=$OLD_IFS
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,11 +321,16 @@ function _ListRecursiveBackupDirectoriesRemote {
|
|||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
local cmd
|
local cmd
|
||||||
|
local directories
|
||||||
|
local directory
|
||||||
|
local retval
|
||||||
|
|
||||||
OLD_IFS=$IFS
|
IFS=$PATH_SEPARATOR_CHAR read -a directories <<< "$RECURSIVE_DIRECTORY_LIST"
|
||||||
IFS=$PATH_SEPARATOR_CHAR
|
#OLD_IFS=$IFS
|
||||||
for directory in $RECURSIVE_DIRECTORY_LIST
|
#IFS=$PATH_SEPARATOR_CHAR
|
||||||
do
|
#TODO CHECK THIS
|
||||||
|
#for directory in $RECURSIVE_DIRECTORY_LIST
|
||||||
|
for directory in "${directories[@]}"; do
|
||||||
cmd=$SSH_CMD' "'$COMMAND_SUDO' '$REMOTE_FIND_CMD' -L '$directory'/ -mindepth 1 -maxdepth 1 -type d" >> '$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID' 2> '$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID
|
cmd=$SSH_CMD' "'$COMMAND_SUDO' '$REMOTE_FIND_CMD' -L '$directory'/ -mindepth 1 -maxdepth 1 -type d" >> '$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID' 2> '$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID
|
||||||
Logger "cmd: $cmd" "DEBUG"
|
Logger "cmd: $cmd" "DEBUG"
|
||||||
eval "$cmd" &
|
eval "$cmd" &
|
||||||
@ -338,7 +348,7 @@ function _ListRecursiveBackupDirectoriesRemote {
|
|||||||
retval=0
|
retval=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS=$OLD_IFS
|
#IFS=$OLD_IFS
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,11 +932,18 @@ function Duplicity {
|
|||||||
function FilesBackup {
|
function FilesBackup {
|
||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
OLD_IFS=$IFS
|
local backupTask
|
||||||
IFS=$PATH_SEPARATOR_CHAR
|
local backupTasks
|
||||||
|
|
||||||
|
#TODO: check this new behavior
|
||||||
|
|
||||||
|
IFS=$PATH_SEPARATOR_CHAR read -a backupTasks <<< "$FILE_BACKUP_TASKS"
|
||||||
|
for backupTask in "${backupTasks[@]}"; do
|
||||||
|
#OLD_IFS=$IFS
|
||||||
|
#IFS=$PATH_SEPARATOR_CHAR
|
||||||
# Backup non recursive directories
|
# Backup non recursive directories
|
||||||
for BACKUP_TASK in $FILE_BACKUP_TASKS
|
#for BACKUP_TASK in $FILE_BACKUP_TASKS
|
||||||
do
|
#do
|
||||||
Logger "Beginning file backup of [$BACKUP_TASK]." "NOTICE"
|
Logger "Beginning file backup of [$BACKUP_TASK]." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ]; then
|
if [ "$ENCRYPTION" == "yes" ]; then
|
||||||
Duplicity "$BACKUP_TASK" "recurse"
|
Duplicity "$BACKUP_TASK" "recurse"
|
||||||
@ -936,9 +953,12 @@ function FilesBackup {
|
|||||||
CheckTotalExecutionTime
|
CheckTotalExecutionTime
|
||||||
done
|
done
|
||||||
|
|
||||||
|
IFS=$PATH_SEPARATOR_CHAR read -a backupTasks <<< "$RECURSIVE_DIRECTORY_LIST"
|
||||||
|
for backupTask in "${backupTasks[@]}"; do
|
||||||
|
|
||||||
## Backup files at root of DIRECTORIES_RECURSE_LIST directories
|
## Backup files at root of DIRECTORIES_RECURSE_LIST directories
|
||||||
for BACKUP_TASK in $RECURSIVE_DIRECTORY_LIST
|
#for BACKUP_TASK in $RECURSIVE_DIRECTORY_LIST
|
||||||
do
|
#do
|
||||||
Logger "Beginning non recursive file backup of [$BACKUP_TASK]." "NOTICE"
|
Logger "Beginning non recursive file backup of [$BACKUP_TASK]." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ]; then
|
if [ "$ENCRYPTION" == "yes" ]; then
|
||||||
Duplicity "$BACKUP_TASK" "no-recurse"
|
Duplicity "$BACKUP_TASK" "no-recurse"
|
||||||
@ -948,9 +968,12 @@ function FilesBackup {
|
|||||||
CheckTotalExecutionTime
|
CheckTotalExecutionTime
|
||||||
done
|
done
|
||||||
|
|
||||||
|
IFS=$PATH_SEPARATOR_CHAR read -a backupTasks <<< "$FILE_RECURSIVE_BACKUP_TASKS"
|
||||||
|
for backupTask in "${backupTasks[@]}"; do
|
||||||
|
|
||||||
# Backup sub directories of recursive directories
|
# Backup sub directories of recursive directories
|
||||||
for BACKUP_TASK in $FILE_RECURSIVE_BACKUP_TASKS
|
#for BACKUP_TASK in $FILE_RECURSIVE_BACKUP_TASKS
|
||||||
do
|
#do
|
||||||
Logger "Beginning recursive file backup of [$BACKUP_TASK]." "NOTICE"
|
Logger "Beginning recursive file backup of [$BACKUP_TASK]." "NOTICE"
|
||||||
if [ "$ENCRYPTION" == "yes" ]; then
|
if [ "$ENCRYPTION" == "yes" ]; then
|
||||||
Duplicity "$BACKUP_TASK" "recurse"
|
Duplicity "$BACKUP_TASK" "recurse"
|
||||||
@ -959,7 +982,7 @@ function FilesBackup {
|
|||||||
fi
|
fi
|
||||||
CheckTotalExecutionTime
|
CheckTotalExecutionTime
|
||||||
done
|
done
|
||||||
IFS=$OLD_IFS
|
#IFS=$OLD_IFS
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckTotalExecutionTime {
|
function CheckTotalExecutionTime {
|
||||||
|
Loading…
Reference in New Issue
Block a user