mirror of
https://github.com/deajan/obackup.git
synced 2024-11-12 19:03:42 +01:00
Simplified CreateDirectoryRemote
This commit is contained in:
parent
a81f741204
commit
b4255318e6
@ -10,7 +10,7 @@ PROGRAM="obackup"
|
||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||
PROGRAM_VERSION=2.1-dev
|
||||
PROGRAM_BUILD=2016122801
|
||||
PROGRAM_BUILD=2016122802
|
||||
IS_STABLE=no
|
||||
|
||||
include #### OFUNCTIONS FULL SUBSET ####
|
||||
@ -622,19 +622,16 @@ function _CreateDirectoryRemote {
|
||||
|
||||
$SSH_CMD env _DEBUG="'$_DEBUG'" env _PARANOIA_DEBUG="'$_PARANOIA_DEBUG'" env _LOGGER_SILENT="'$_LOGGER_SILENT'" env _LOGGER_VERBOSE="'$_LOGGER_VERBOSE'" env _LOGGER_PREFIX="'$_LOGGER_PREFIX'" env _LOGGER_ERR_ONLY="'$_LOGGER_ERR_ONLY'" \
|
||||
env PROGRAM="'$PROGRAM'" env SCRIPT_PID="'$SCRIPT_PID'" TSTAMP="'$TSTAMP'" \
|
||||
env dirToCreate="'$dirToCreate'" $COMMAND_SUDO' bash -s' << 'ENDSSH' > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" &
|
||||
env dirToCreate="'$dirToCreate'" $COMMAND_SUDO' bash -s' << 'ENDSSH' > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2&1 &
|
||||
include #### DEBUG SUBSET ####
|
||||
include #### TrapError SUBSET ####
|
||||
include #### RemoteLogger SUBSET ####
|
||||
|
||||
if [ ! -d "$dirToCreate" ]; then
|
||||
# No sudo, you should have all necessary rights
|
||||
mkdir -p "$dirToCreate" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2>&1 &
|
||||
mkdir -p "$dirToCreate"
|
||||
if [ $? != 0 ]; then
|
||||
RemoteLogger "Cannot create directory [$dirToCreate]" "CRITICAL"
|
||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
||||
RemoteLogger "Command output: $(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@ -642,7 +639,7 @@ ENDSSH
|
||||
WaitForTaskCompletion $! 720 1800 $SLEEP_TIME $KEEP_LOGGING true true false
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create remote directory [$dirToCreate]." "CRITICAL"
|
||||
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
||||
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user