Multiple typo fixes and forgotten cmd exec

This commit is contained in:
deajan 2017-01-03 14:13:53 +01:00
parent 6335e889ea
commit 5dba4dc808
1 changed files with 15 additions and 4 deletions

View File

@ -7,7 +7,7 @@ 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.1-dev PROGRAM_VERSION=2.1-dev
PROGRAM_BUILD=2017010303 PROGRAM_BUILD=2017010304
IS_STABLE=no IS_STABLE=no
# Execution order #__WITH_PARANOIA_DEBUG # Execution order #__WITH_PARANOIA_DEBUG
@ -450,6 +450,7 @@ function _ListRecursiveBackupDirectoriesRemoteSub {
IFS=$PATH_SEPARATOR_CHAR read -r -a directories <<< "$RECURSIVE_DIRECTORY_LIST" IFS=$PATH_SEPARATOR_CHAR read -r -a directories <<< "$RECURSIVE_DIRECTORY_LIST"
for directory in "${directories[@]}"; do for directory in "${directories[@]}"; do
cmd="$REMOTE_FIND_CMD -L \"$directory\"/ -mindepth 1 -maxdepth 1 -type d" cmd="$REMOTE_FIND_CMD -L \"$directory\"/ -mindepth 1 -maxdepth 1 -type d"
eval $cmd
retval=$? retval=$?
if [ $retval -ne 0 ]; then if [ $retval -ne 0 ]; then
RemoteLogger "Could not enumerate directories in [$directory]." "ERROR" RemoteLogger "Could not enumerate directories in [$directory]." "ERROR"
@ -508,7 +509,7 @@ function ListRecursiveBackupDirectories {
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
output_file="" output_file=""
else else
output_file="$RUN_DIR/$PROGRAM._ListRecursiveBackupDirectoriesRemote.$SCRIPT_PID.$TSTAMP" output_file="$RUN_DIR/$PROGRAM._ListRecursiveBackupDirectoriesRemote.$SCRIPT_PID.$TSTAMP"
fi fi
fi fi
@ -612,9 +613,11 @@ include #### RemoteLogger SUBSET ####
cmd="du -cs $dirList | tail -n1 | cut -f1" cmd="du -cs $dirList | tail -n1 | cut -f1"
eval "$cmd" eval "$cmd"
if [ $? != 0 ]; then retval=$?
if [ $retval != 0 ]; then
RemoteLogger "Command was [$cmd]." "WARN" RemoteLogger "Command was [$cmd]." "WARN"
fi fi
exit $retval
ENDSSH ENDSSH
# $cmd will return 0 even if some errors found, so we need to check if there is an error output # $cmd will return 0 even if some errors found, so we need to check if there is an error output
WaitForTaskCompletion $! $SOFT_MAX_EXEC_TIME_FILE_TASK $HARD_MAX_EXEC_TIME_FILE_TASK $SLEEP_TIME $KEEP_LOGGING true true false WaitForTaskCompletion $! $SOFT_MAX_EXEC_TIME_FILE_TASK $HARD_MAX_EXEC_TIME_FILE_TASK $SLEEP_TIME $KEEP_LOGGING true true false
@ -703,6 +706,7 @@ include #### RemoteLogger SUBSET ####
return $retval return $retval
fi fi
fi fi
return 0
ENDSSH ENDSSH
WaitForTaskCompletion $! 720 1800 $SLEEP_TIME $KEEP_LOGGING true true false WaitForTaskCompletion $! 720 1800 $SLEEP_TIME $KEEP_LOGGING true true false
retval=$? retval=$?
@ -808,7 +812,14 @@ function _GetDiskSpaceRemoteSub {
if [ -d "$pathToCheck" ]; then if [ -d "$pathToCheck" ]; then
# Not elegant solution to make df silent on errors # Not elegant solution to make df silent on errors
# No sudo on local commands, assuming you should have all the necesarry rights to check backup directories sizes # No sudo on local commands, assuming you should have all the necesarry rights to check backup directories sizes
$DF_CMD "$pathToCheck" cmd="$DF_CMD \"$pathToCheck\""
if [ $? != 0 ]; then
RemoteLogger "Error getting [$pathToCheck] size." "CRITICAL"
RemoteLogger "Command was [$cmd]." "WARN"
return 1
else
return 0
fi
else else
RemoteLogger "Storage path [$pathToCheck] does not exist." "CRITICAL" RemoteLogger "Storage path [$pathToCheck] does not exist." "CRITICAL"
return 1 return 1