mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 15:13:53 +01:00
Fixed bogus SSH_OPTS variable
This commit is contained in:
parent
a7e8487df3
commit
60266c40a6
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
###### Remote push/pull (or local) backup script for files & databases
|
###### Remote push/pull (or local) backup script for files & databases
|
||||||
PROGRAM="obackup"
|
PROGRAM="obackup"
|
||||||
AUTHOR="(L) 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.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2016031801
|
PROGRAM_BUILD=2016031801
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
## FUNC_BUILD=2016032501
|
## FUNC_BUILD=2016033101
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -92,11 +92,15 @@ function Dummy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _Logger {
|
function _Logger {
|
||||||
local svalue="${1}" # What to log to screen
|
local svalue="${1}" # What to log to stdout
|
||||||
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
||||||
|
local evalue="${3}" # What to log to stderr
|
||||||
echo -e "$lvalue" >> "$LOG_FILE"
|
echo -e "$lvalue" >> "$LOG_FILE"
|
||||||
|
|
||||||
if [ $_SILENT -eq 0 ]; then
|
# <OSYNC SPECIFIC> Special case in daemon mode where systemctl doesn't need double timestamps
|
||||||
|
if [ "$sync_on_changes" == "1" ]; then
|
||||||
|
cat <<< "$evalue" 1>&2 # Log to stderr in daemon mode
|
||||||
|
elif [ $_SILENT -eq 0 ]; then
|
||||||
echo -e "$svalue"
|
echo -e "$svalue"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -114,15 +118,15 @@ function Logger {
|
|||||||
# </OSYNC SPECIFIC>
|
# </OSYNC SPECIFIC>
|
||||||
|
|
||||||
if [ "$level" == "CRITICAL" ]; then
|
if [ "$level" == "CRITICAL" ]; then
|
||||||
_Logger "$prefix\e[41m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[41m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
ERROR_ALERT=1
|
ERROR_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "ERROR" ]; then
|
elif [ "$level" == "ERROR" ]; then
|
||||||
_Logger "$prefix\e[91m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[91m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
ERROR_ALERT=1
|
ERROR_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "WARN" ]; then
|
elif [ "$level" == "WARN" ]; then
|
||||||
_Logger "$prefix\e[93m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[93m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
WARN_ALERT=1
|
WARN_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "NOTICE" ]; then
|
elif [ "$level" == "NOTICE" ]; then
|
||||||
@ -495,7 +499,7 @@ function GetRemoteOS {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$IGNORE_OS_VER" == "yes" ]; then #DOC: Undocumented option
|
if [ "$IGNORE_OS_TYPE" == "yes" ]; then #DOC: Undocumented option
|
||||||
Logger "Running on unknown remote OS [$remote_os_var]." "WARN"
|
Logger "Running on unknown remote OS [$remote_os_var]." "WARN"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -978,7 +982,7 @@ function PostInit {
|
|||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
# Define remote commands
|
# Define remote commands
|
||||||
SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $SSH_IGNORE_KNOWN_HOSTS $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT"
|
SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $SSH_OPTS $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT"
|
||||||
SCP_CMD="$(type -p scp) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -P $REMOTE_PORT"
|
SCP_CMD="$(type -p scp) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -P $REMOTE_PORT"
|
||||||
RSYNC_SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT"
|
RSYNC_SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT"
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
###### Remote push/pull (or local) backup script for files & databases
|
###### Remote push/pull (or local) backup script for files & databases
|
||||||
PROGRAM="obackup"
|
PROGRAM="obackup"
|
||||||
AUTHOR="(L) 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.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2016031801
|
PROGRAM_BUILD=2016031801
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
## FUNC_BUILD=2016032501
|
## FUNC_BUILD=2016033101
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -82,11 +82,15 @@ function Dummy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _Logger {
|
function _Logger {
|
||||||
local svalue="${1}" # What to log to screen
|
local svalue="${1}" # What to log to stdout
|
||||||
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
||||||
|
local evalue="${3}" # What to log to stderr
|
||||||
echo -e "$lvalue" >> "$LOG_FILE"
|
echo -e "$lvalue" >> "$LOG_FILE"
|
||||||
|
|
||||||
if [ $_SILENT -eq 0 ]; then
|
# <OSYNC SPECIFIC> Special case in daemon mode where systemctl doesn't need double timestamps
|
||||||
|
if [ "$sync_on_changes" == "1" ]; then
|
||||||
|
cat <<< "$evalue" 1>&2 # Log to stderr in daemon mode
|
||||||
|
elif [ $_SILENT -eq 0 ]; then
|
||||||
echo -e "$svalue"
|
echo -e "$svalue"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -104,15 +108,15 @@ function Logger {
|
|||||||
# </OSYNC SPECIFIC>
|
# </OSYNC SPECIFIC>
|
||||||
|
|
||||||
if [ "$level" == "CRITICAL" ]; then
|
if [ "$level" == "CRITICAL" ]; then
|
||||||
_Logger "$prefix\e[41m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[41m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
ERROR_ALERT=1
|
ERROR_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "ERROR" ]; then
|
elif [ "$level" == "ERROR" ]; then
|
||||||
_Logger "$prefix\e[91m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[91m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
ERROR_ALERT=1
|
ERROR_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "WARN" ]; then
|
elif [ "$level" == "WARN" ]; then
|
||||||
_Logger "$prefix\e[93m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[93m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
WARN_ALERT=1
|
WARN_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "NOTICE" ]; then
|
elif [ "$level" == "NOTICE" ]; then
|
||||||
@ -485,7 +489,7 @@ function GetRemoteOS {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$IGNORE_OS_VER" == "yes" ]; then #DOC: Undocumented option
|
if [ "$IGNORE_OS_TYPE" == "yes" ]; then #DOC: Undocumented option
|
||||||
Logger "Running on unknown remote OS [$remote_os_var]." "WARN"
|
Logger "Running on unknown remote OS [$remote_os_var]." "WARN"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -968,7 +972,7 @@ function PostInit {
|
|||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
# Define remote commands
|
# Define remote commands
|
||||||
SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $SSH_IGNORE_KNOWN_HOSTS $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT"
|
SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $SSH_OPTS $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT"
|
||||||
SCP_CMD="$(type -p scp) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -P $REMOTE_PORT"
|
SCP_CMD="$(type -p scp) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -P $REMOTE_PORT"
|
||||||
RSYNC_SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT"
|
RSYNC_SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT"
|
||||||
}
|
}
|
||||||
|
22
obackup.sh
22
obackup.sh
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
###### Remote push/pull (or local) backup script for files & databases
|
###### Remote push/pull (or local) backup script for files & databases
|
||||||
PROGRAM="obackup"
|
PROGRAM="obackup"
|
||||||
AUTHOR="(L) 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.0-pre
|
PROGRAM_VERSION=2.0-pre
|
||||||
PROGRAM_BUILD=2016031801
|
PROGRAM_BUILD=2016031801
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
## FUNC_BUILD=2016032501
|
## FUNC_BUILD=2016033101
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -87,11 +87,15 @@ function Dummy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _Logger {
|
function _Logger {
|
||||||
local svalue="${1}" # What to log to screen
|
local svalue="${1}" # What to log to stdout
|
||||||
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
local lvalue="${2:-$svalue}" # What to log to logfile, defaults to screen value
|
||||||
|
local evalue="${3}" # What to log to stderr
|
||||||
echo -e "$lvalue" >> "$LOG_FILE"
|
echo -e "$lvalue" >> "$LOG_FILE"
|
||||||
|
|
||||||
if [ $_SILENT -eq 0 ]; then
|
# <OSYNC SPECIFIC> Special case in daemon mode where systemctl doesn't need double timestamps
|
||||||
|
if [ "$sync_on_changes" == "1" ]; then
|
||||||
|
cat <<< "$evalue" 1>&2 # Log to stderr in daemon mode
|
||||||
|
elif [ $_SILENT -eq 0 ]; then
|
||||||
echo -e "$svalue"
|
echo -e "$svalue"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -109,15 +113,15 @@ function Logger {
|
|||||||
# </OSYNC SPECIFIC>
|
# </OSYNC SPECIFIC>
|
||||||
|
|
||||||
if [ "$level" == "CRITICAL" ]; then
|
if [ "$level" == "CRITICAL" ]; then
|
||||||
_Logger "$prefix\e[41m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[41m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
ERROR_ALERT=1
|
ERROR_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "ERROR" ]; then
|
elif [ "$level" == "ERROR" ]; then
|
||||||
_Logger "$prefix\e[91m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[91m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
ERROR_ALERT=1
|
ERROR_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "WARN" ]; then
|
elif [ "$level" == "WARN" ]; then
|
||||||
_Logger "$prefix\e[93m$value\e[0m" "$prefix$level:$value"
|
_Logger "$prefix\e[93m$value\e[0m" "$prefix$level:$value" "$level:$value"
|
||||||
WARN_ALERT=1
|
WARN_ALERT=1
|
||||||
return
|
return
|
||||||
elif [ "$level" == "NOTICE" ]; then
|
elif [ "$level" == "NOTICE" ]; then
|
||||||
@ -480,7 +484,7 @@ function GetRemoteOS {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$IGNORE_OS_VER" == "yes" ]; then #DOC: Undocumented option
|
if [ "$IGNORE_OS_TYPE" == "yes" ]; then #DOC: Undocumented option
|
||||||
Logger "Running on unknown remote OS [$remote_os_var]." "WARN"
|
Logger "Running on unknown remote OS [$remote_os_var]." "WARN"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -908,7 +912,7 @@ function PreInit {
|
|||||||
function PostInit {
|
function PostInit {
|
||||||
|
|
||||||
# Define remote commands
|
# Define remote commands
|
||||||
SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $SSH_IGNORE_KNOWN_HOSTS $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT"
|
SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $SSH_OPTS $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT"
|
||||||
SCP_CMD="$(type -p scp) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -P $REMOTE_PORT"
|
SCP_CMD="$(type -p scp) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -P $REMOTE_PORT"
|
||||||
RSYNC_SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT"
|
RSYNC_SSH_CMD="$(type -p ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY -p $REMOTE_PORT"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user