Don't show failed commands in stdout, only log them

This commit is contained in:
deajan 2017-02-10 11:15:41 +01:00
parent 81438ce2fd
commit 685d1d0bf1
1 changed files with 11 additions and 11 deletions

View File

@ -3,9 +3,9 @@
PROGRAM="osync" # Rsync based two way sync engine with fault tolerance PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2017 by Orsiris de Jong" AUTHOR="(C) 2013-2017 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.2-RC2 PROGRAM_VERSION=1.2-RC2+dev
PROGRAM_BUILD=2017020802 PROGRAM_BUILD=2017021001
IS_STABLE=yes IS_STABLE=no
##### Execution order #__WITH_PARANOIA_DEBUG ##### Execution order #__WITH_PARANOIA_DEBUG
##### Function Name Is parallel #__WITH_PARANOIA_DEBUG ##### Function Name Is parallel #__WITH_PARANOIA_DEBUG
@ -719,7 +719,7 @@ function treeList {
return 0 return 0
else else
Logger "Cannot create replica file list in [$replicaPath]." "CRITICAL" $retval Logger "Cannot create replica file list in [$replicaPath]." "CRITICAL" $retval
Logger "Command was [$rsyncCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
Logger "Command output\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP)" "WARN" Logger "Command output\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP)" "WARN"
return $retval return $retval
fi fi
@ -762,7 +762,7 @@ function deleteList {
if [ $retval -ne 0 ]; then if [ $retval -ne 0 ]; then
Logger "Could not prepare $replicaType deletion list." "CRITICAL" $retval Logger "Could not prepare $replicaType deletion list." "CRITICAL" $retval
Logger "Command was [$cmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
return $retval return $retval
fi fi
@ -821,7 +821,7 @@ function _getFileCtimeMtimeRemote {
retval=$? retval=$?
if [ $retval -ne 0 ]; then if [ $retval -ne 0 ]; then
Logger "Sending ctime required file list failed with [$retval] on $replicaType. Stopping execution." "CRITICAL" $retval Logger "Sending ctime required file list failed with [$retval] on $replicaType. Stopping execution." "CRITICAL" $retval
Logger "Command was [$cmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
if [ -f "$RUN_DIR/$PROGRAM.ctime_mtime.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then if [ -f "$RUN_DIR/$PROGRAM.ctime_mtime.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.ctime_mtime.$replicaType.$SCRIPT_PID.$TSTAMP)" "WARN" Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.ctime_mtime.$replicaType.$SCRIPT_PID.$TSTAMP)" "WARN"
fi fi
@ -887,7 +887,7 @@ function syncAttrs {
if [ $retval -ne 0 ] && [ $retval -ne 24 ]; then if [ $retval -ne 0 ] && [ $retval -ne 24 ]; then
Logger "Getting list of files that need updates failed [$retval]. Stopping execution." "CRITICAL" $retval Logger "Getting list of files that need updates failed [$retval]. Stopping execution." "CRITICAL" $retval
Logger "Command was [$rsyncCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
Logger "Rsync output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "NOTICE" Logger "Rsync output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "NOTICE"
fi fi
@ -974,7 +974,7 @@ function syncAttrs {
if [ $retval -ne 0 ] && [ $retval -ne 24 ]; then if [ $retval -ne 0 ] && [ $retval -ne 24 ]; then
Logger "Updating file attributes on $destReplica [$retval]. Stopping execution." "CRITICAL" $retval Logger "Updating file attributes on $destReplica [$retval]. Stopping execution." "CRITICAL" $retval
Logger "Command was [$rsyncCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
if [ -f "$RUN_DIR/$PROGRAM.attr-update.$destReplica.$SCRIPT_PID.$TSTAMP" ]; then if [ -f "$RUN_DIR/$PROGRAM.attr-update.$destReplica.$SCRIPT_PID.$TSTAMP" ]; then
Logger "Rsync output:\n$(cat $RUN_DIR/$PROGRAM.attr-update.$destReplica.$SCRIPT_PID.$TSTAMP)" "NOTICE" Logger "Rsync output:\n$(cat $RUN_DIR/$PROGRAM.attr-update.$destReplica.$SCRIPT_PID.$TSTAMP)" "NOTICE"
fi fi
@ -1037,7 +1037,7 @@ function syncUpdate {
if [ $retval -ne 0 ] && [ $retval -ne 24 ]; then if [ $retval -ne 0 ] && [ $retval -ne 24 ]; then
Logger "Updating $destinationReplica replica failed. Stopping execution." "CRITICAL" $retval Logger "Updating $destinationReplica replica failed. Stopping execution." "CRITICAL" $retval
Logger "Command was [$rsyncCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
if [ -f "$RUN_DIR/$PROGRAM.update.$destinationReplica.$SCRIPT_PID.$TSTAMP" ]; then if [ -f "$RUN_DIR/$PROGRAM.update.$destinationReplica.$SCRIPT_PID.$TSTAMP" ]; then
Logger "Rsync output:\n$(cat $RUN_DIR/$PROGRAM.update.$destinationReplica.$SCRIPT_PID.$TSTAMP)" "NOTICE" Logger "Rsync output:\n$(cat $RUN_DIR/$PROGRAM.update.$destinationReplica.$SCRIPT_PID.$TSTAMP)" "NOTICE"
fi fi
@ -1168,7 +1168,7 @@ function _deleteRemote {
retval=$? retval=$?
if [ $retval -ne 0 ]; then if [ $retval -ne 0 ]; then
Logger "Cannot copy the deletion list to remote replica." "ERROR" $retval Logger "Cannot copy the deletion list to remote replica." "ERROR" $retval
Logger "Command was [$rsyncCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID.$TSTAMP" ]; then if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID.$TSTAMP" ]; then
Logger "$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID.$TSTAMP)" "ERROR" Logger "$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID.$TSTAMP)" "ERROR"
fi fi
@ -1266,7 +1266,7 @@ ENDSSH
retval=$? retval=$?
if [ $retval -ne 0 ]; then if [ $retval -ne 0 ]; then
Logger "Cannot copy back the failed deletion list to initiator replica." "CRITICAL" $retval Logger "Cannot copy back the failed deletion list to initiator replica." "CRITICAL" $retval
Logger "Command was [$rsyncCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
if [ -f "$RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID.$TSTAMP" ]; then if [ -f "$RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID.$TSTAMP" ]; then
Logger "Comand output: $(cat $RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID.$TSTAMP)" "NOTICE" Logger "Comand output: $(cat $RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID.$TSTAMP)" "NOTICE"
fi fi