mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 15:13:53 +01:00
Updated ofunctions.sh with userland logging
This commit is contained in:
parent
4ad99413f4
commit
e3c9c5cb18
@ -1,4 +1,4 @@
|
|||||||
## FUNC_BUILD=2016040102
|
## FUNC_BUILD=2016040602
|
||||||
## 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
|
||||||
@ -54,6 +54,8 @@ LOCAL_HOST=$(hostname)
|
|||||||
## Default log file until config file is loaded
|
## Default log file until config file is loaded
|
||||||
if [ -w /var/log ]; then
|
if [ -w /var/log ]; then
|
||||||
LOG_FILE="/var/log/$PROGRAM.log"
|
LOG_FILE="/var/log/$PROGRAM.log"
|
||||||
|
elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then
|
||||||
|
LOG_FILE="$HOME/$PROGRAM.log"
|
||||||
else
|
else
|
||||||
LOG_FILE="./$PROGRAM.log"
|
LOG_FILE="./$PROGRAM.log"
|
||||||
fi
|
fi
|
||||||
@ -720,7 +722,7 @@ function CheckConnectivityRemoteHost {
|
|||||||
eval "$PING_CMD $REMOTE_HOST > /dev/null 2>&1" &
|
eval "$PING_CMD $REMOTE_HOST > /dev/null 2>&1" &
|
||||||
WaitForTaskCompletion $! 180 180 ${FUNCNAME[0]}
|
WaitForTaskCompletion $! 180 180 ${FUNCNAME[0]}
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
Logger "Cannot ping $REMOTE_HOST" "CRITICAL"
|
Logger "Cannot ping $REMOTE_HOST" "ERROR"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -1013,8 +1015,10 @@ function InitLocalOSSettings {
|
|||||||
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
||||||
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
||||||
STAT_CMD="stat -f \"%Sm\""
|
STAT_CMD="stat -f \"%Sm\""
|
||||||
|
STAT_CTIME_MTIME_CMD="stat -f %N;%c;%m"
|
||||||
else
|
else
|
||||||
STAT_CMD="stat --format %y"
|
STAT_CMD="stat --format %y"
|
||||||
|
STAT_CTIME_MTIME_CMD="stat -c %n;%Z;%Y"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,6 +1035,16 @@ function InitRemoteOSSettings {
|
|||||||
else
|
else
|
||||||
REMOTE_FIND_CMD=find
|
REMOTE_FIND_CMD=find
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
||||||
|
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
||||||
|
REMOTE_STAT_CMD="stat -f \"%Sm\""
|
||||||
|
REMOTE_STAT_CTIME_MTIME_CMD="stat -f \\\"%N;%c;%m\\\""
|
||||||
|
else
|
||||||
|
REMOTE_STAT_CMD="stat --format %y"
|
||||||
|
REMOTE_STAT_CTIME_MTIME_CMD="stat -c \\\"%n;%Z;%Y\\\""
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## END Generic functions
|
## END Generic functions
|
||||||
|
Loading…
Reference in New Issue
Block a user