diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 03fa60d..e2f4794 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -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 ## 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 if [ -w /var/log ]; then LOG_FILE="/var/log/$PROGRAM.log" +elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then + LOG_FILE="$HOME/$PROGRAM.log" else LOG_FILE="./$PROGRAM.log" fi @@ -720,7 +722,7 @@ function CheckConnectivityRemoteHost { eval "$PING_CMD $REMOTE_HOST > /dev/null 2>&1" & WaitForTaskCompletion $! 180 180 ${FUNCNAME[0]} if [ $? != 0 ]; then - Logger "Cannot ping $REMOTE_HOST" "CRITICAL" + Logger "Cannot ping $REMOTE_HOST" "ERROR" return 1 fi fi @@ -1013,8 +1015,10 @@ function InitLocalOSSettings { ## Stat command has different syntax on Linux and FreeBSD/MacOSX if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then STAT_CMD="stat -f \"%Sm\"" + STAT_CTIME_MTIME_CMD="stat -f %N;%c;%m" else STAT_CMD="stat --format %y" + STAT_CTIME_MTIME_CMD="stat -c %n;%Z;%Y" fi } @@ -1031,6 +1035,16 @@ function InitRemoteOSSettings { else REMOTE_FIND_CMD=find 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