Skip to content

Commit

Permalink
Rebuilt targetsé
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Mar 15, 2020
1 parent 8788582 commit 6edce24
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 92 deletions.
42 changes: 22 additions & 20 deletions dev/debug_osync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
93 changes: 56 additions & 37 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ PROGRAM_BINARY=$PROGRAM".sh"
PROGRAM_BATCH=$PROGRAM"-batch.sh"
SSH_FILTER="ssh_filter.sh"

SCRIPT_BUILD=2020011001
SCRIPT_BUILD=2020031501
INSTANCE_ID="installer-$SCRIPT_BUILD"

## osync / obackup / pmocr / zsnap install script
## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8, 10 and 11
## Please adapt this to fit your distro needs

_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
Expand Down Expand Up @@ -378,6 +378,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
Expand All @@ -397,23 +415,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
}


# Get current install.sh path from http://stackoverflow.com/a/246128/2635443
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down Expand Up @@ -575,6 +576,41 @@ function GetConfFileValue () {
fi
}

function CleanUp {
# Exit controlmaster before it's socket gets deleted
if [ "$SSH_CONTROLMASTER" == true ] && [ "$SSH_CMD" != "" ]; then
$SSH_CMD -O exit
fi

if [ "$_DEBUG" != true ]; then
# Removing optional remote $RUN_DIR that goes into local $RUN_DIR
if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then
rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP"
fi
# Removing all temporary run files
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP"
# Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements)
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp"
fi
}

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 SetLocalOSSettings {
USER=root
Expand Down Expand Up @@ -873,23 +909,6 @@ function Usage {
exit 127
}

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

CleanUp
exit $exitcode
}

############################## Script entry point

function GetCommandlineArguments {
Expand Down
30 changes: 15 additions & 15 deletions osync-batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
42 changes: 22 additions & 20 deletions osync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6edce24

Please sign in to comment.