-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Mar 15, 2020
1 parent
8788582
commit 6edce24
Showing
4 changed files
with
115 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance | |
AUTHOR="(C) 2013-2020 by Orsiris de Jong" | ||
CONTACT="http://www.netpower.fr/osync - [email protected]" | ||
PROGRAM_VERSION=1.3.0-prerc1 | ||
PROGRAM_BUILD=2020012301 | ||
PROGRAM_BUILD=2020012302 | ||
IS_STABLE=false | ||
|
||
CONFIG_FILE_REVISION_REQUIRED=1.3.0 | ||
|
@@ -42,8 +42,8 @@ CONFIG_FILE_REVISION_REQUIRED=1.3.0 | |
# UnlockReplicas yes #__WITH_PARANOIA_DEBUG | ||
# CleanUp no #__WITH_PARANOIA_DEBUG | ||
|
||
_OFUNCTIONS_VERSION=2.3.0-RC3 | ||
_OFUNCTIONS_BUILD=2019122501 | ||
_OFUNCTIONS_VERSION=2.3.0-RC4 | ||
_OFUNCTIONS_BUILD=2020031501 | ||
_OFUNCTIONS_BOOTSTRAP=true | ||
|
||
if ! type "$BASH" > /dev/null; then | ||
|
@@ -419,6 +419,24 @@ function KillAllChilds { | |
return $errorcount | ||
} | ||
|
||
function GenericTrapQuit { | ||
local exitcode=0 | ||
|
||
# Get ERROR / WARN alert flags from subprocesses that call Logger | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then | ||
WARN_ALERT=true | ||
exitcode=2 | ||
fi | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then | ||
ERROR_ALERT=true | ||
exitcode=1 | ||
fi | ||
|
||
CleanUp | ||
exit $exitcode | ||
} | ||
|
||
|
||
function CleanUp { | ||
# Exit controlmaster before it's socket gets deleted | ||
if [ "$SSH_CONTROLMASTER" == true ] && [ "$SSH_CMD" != "" ]; then | ||
|
@@ -438,23 +456,6 @@ function CleanUp { | |
} | ||
|
||
|
||
function GenericTrapQuit { | ||
local exitcode=0 | ||
|
||
# Get ERROR / WARN alert flags from subprocesses that call Logger | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then | ||
WARN_ALERT=true | ||
exitcode=2 | ||
fi | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then | ||
ERROR_ALERT=true | ||
exitcode=1 | ||
fi | ||
|
||
CleanUp | ||
exit $exitcode | ||
} | ||
|
||
|
||
# osync/obackup/pmocr script specific mail alert function, use SendEmail function for generic mail sending | ||
function SendAlert { | ||
|
@@ -4423,6 +4424,7 @@ $SSH_CMD env _REMOTE_TOKEN="$_REMOTE_TOKEN" \ | |
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 _REMOTE_EXECUTION="true" env PROGRAM="'$PROGRAM'" env SCRIPT_PID="'$SCRIPT_PID'" env TSTAMP="'$TSTAMP'" \ | ||
env _DRYRUN="'$_DRYRUN'" \ | ||
env LOCAL_OS="$REMOTE_OS" \ | ||
env FILE_LIST="'${TARGET[$__replicaDir]}${TARGET[$__stateDir]}/$deletionListFromReplica${INITIATOR[$__deletedListFile]}'" env REPLICA_DIR="'$replicaDir'" env SOFT_DELETE="'$SOFT_DELETE'" \ | ||
env DELETION_DIR="'$(EscapeSpaces "$deletionDir")'" env FAILED_DELETE_LIST="'$failedDeleteList'" env SUCCESS_DELETE_LIST="'$successDeleteList'" env REPLICA_TYPE="'$replicaType'" \ | ||
env LC_ALL=C $COMMAND_SUDO' bash -s' << 'ENDSSH' >> "$RUN_DIR/$PROGRAM.remote_deletion.$SCRIPT_PID.$TSTAMP" 2>&1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ SUBPROGRAM=osync | |
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones | ||
AUTHOR="(L) 2013-2020 by Orsiris de Jong" | ||
CONTACT="http://www.netpower.fr - [email protected]" | ||
PROGRAM_BUILD=2019090901 | ||
PROGRAM_BUILD=2020031501 | ||
|
||
## Runs an osync /obackup instance for every conf file found | ||
## If an instance fails, run it again if time permits | ||
|
@@ -220,24 +220,24 @@ function CleanUp { | |
fi | ||
} | ||
|
||
function GenericTrapQuit { | ||
local exitcode=0 | ||
|
||
function TrapQuit { | ||
local exitcode=0 | ||
|
||
# Get ERROR / WARN alert flags from subprocesses that call Logger | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then | ||
WARN_ALERT=true | ||
exitcode=2 | ||
fi | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then | ||
ERROR_ALERT=true | ||
exitcode=1 | ||
fi | ||
# Get ERROR / WARN alert flags from subprocesses that call Logger | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then | ||
WARN_ALERT=true | ||
exitcode=2 | ||
fi | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then | ||
ERROR_ALERT=true | ||
exitcode=1 | ||
fi | ||
|
||
CleanUp | ||
exit $exitcode | ||
CleanUp | ||
exit $exitcode | ||
} | ||
|
||
|
||
function CheckEnvironment { | ||
## osync / obackup executable full path can be set here if it cannot be found on the system | ||
if ! type $SUBPROGRAM.sh > /dev/null 2>&1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,14 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance | |
AUTHOR="(C) 2013-2020 by Orsiris de Jong" | ||
CONTACT="http://www.netpower.fr/osync - [email protected]" | ||
PROGRAM_VERSION=1.3.0-prerc1 | ||
PROGRAM_BUILD=2020012301 | ||
PROGRAM_BUILD=2020012302 | ||
IS_STABLE=false | ||
|
||
CONFIG_FILE_REVISION_REQUIRED=1.3.0 | ||
|
||
|
||
_OFUNCTIONS_VERSION=2.3.0-RC3 | ||
_OFUNCTIONS_BUILD=2019122501 | ||
_OFUNCTIONS_VERSION=2.3.0-RC4 | ||
_OFUNCTIONS_BUILD=2020031501 | ||
_OFUNCTIONS_BOOTSTRAP=true | ||
|
||
if ! type "$BASH" > /dev/null; then | ||
|
@@ -374,6 +374,24 @@ function KillAllChilds { | |
return $errorcount | ||
} | ||
|
||
function GenericTrapQuit { | ||
local exitcode=0 | ||
|
||
# Get ERROR / WARN alert flags from subprocesses that call Logger | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then | ||
WARN_ALERT=true | ||
exitcode=2 | ||
fi | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then | ||
ERROR_ALERT=true | ||
exitcode=1 | ||
fi | ||
|
||
CleanUp | ||
exit $exitcode | ||
} | ||
|
||
|
||
function CleanUp { | ||
# Exit controlmaster before it's socket gets deleted | ||
if [ "$SSH_CONTROLMASTER" == true ] && [ "$SSH_CMD" != "" ]; then | ||
|
@@ -393,23 +411,6 @@ function CleanUp { | |
} | ||
|
||
|
||
function GenericTrapQuit { | ||
local exitcode=0 | ||
|
||
# Get ERROR / WARN alert flags from subprocesses that call Logger | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then | ||
WARN_ALERT=true | ||
exitcode=2 | ||
fi | ||
if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then | ||
ERROR_ALERT=true | ||
exitcode=1 | ||
fi | ||
|
||
CleanUp | ||
exit $exitcode | ||
} | ||
|
||
|
||
# osync/obackup/pmocr script specific mail alert function, use SendEmail function for generic mail sending | ||
function SendAlert { | ||
|
@@ -4225,6 +4226,7 @@ $SSH_CMD env _REMOTE_TOKEN="$_REMOTE_TOKEN" \ | |
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 _REMOTE_EXECUTION="true" env PROGRAM="'$PROGRAM'" env SCRIPT_PID="'$SCRIPT_PID'" env TSTAMP="'$TSTAMP'" \ | ||
env _DRYRUN="'$_DRYRUN'" \ | ||
env LOCAL_OS="$REMOTE_OS" \ | ||
env FILE_LIST="'${TARGET[$__replicaDir]}${TARGET[$__stateDir]}/$deletionListFromReplica${INITIATOR[$__deletedListFile]}'" env REPLICA_DIR="'$replicaDir'" env SOFT_DELETE="'$SOFT_DELETE'" \ | ||
env DELETION_DIR="'$(EscapeSpaces "$deletionDir")'" env FAILED_DELETE_LIST="'$failedDeleteList'" env SUCCESS_DELETE_LIST="'$successDeleteList'" env REPLICA_TYPE="'$replicaType'" \ | ||
env LC_ALL=C $COMMAND_SUDO' bash -s' << 'ENDSSH' >> "$RUN_DIR/$PROGRAM.remote_deletion.$SCRIPT_PID.$TSTAMP" 2>&1 | ||
|