diff --git a/CHANGELOG.md b/CHANGELOG.md index 30baa20..8cae475 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ RECENT CHANGES -------------- - Added LSB info to init script for Debian based distros +- Integrated new realpath emulation from https://github.com/mkropat/sh-realpath +- 22 Jul. 2015: Osync v1.00a released - Small improvements in osync-batch.sh time management - Improved various logging on error - Work in progress: Unit tests (intial tests written by onovy, Thanks again!) diff --git a/osync-batch.sh b/osync-batch.sh index 8d385cc..8c65b5a 100755 --- a/osync-batch.sh +++ b/osync-batch.sh @@ -3,7 +3,7 @@ PROGRAM="Osync-batch" # Batch program to run osync instances sequentially and rerun failed ones AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" -PROGRAM_BUILD=2015042501 +PROGRAM_BUILD=2015082501 ## Runs an osync instance for every conf file found ## If an instance fails, run it again if time permits @@ -117,6 +117,7 @@ function Usage echo "--path=/path/to/conf Path to osync conf files, defaults to /etc/osync" echo "--max-reruns=X Number of runs max for failed instances, (defaults to 3)" echo "--max-exec-time=X Retry failed instances only if max execution time not reached (defaults to 36000 seconds). Set to 0 to bypass execution time check." + echo "--no-maxtime Run osync without honoring conf file defined timeouts" echo "--dry Will run osync without actually doing anything; just testing" echo "--silent Will run osync without any output to stdout, used for cron jobs" echo "--verbose Increases output" @@ -154,7 +155,7 @@ do --max-exec-time=*) MAX_EXECUTION_TIME=${i##*=} ;; - --help|-h) + --help|-h|-?) Usage ;; *) diff --git a/osync.sh b/osync.sh index 02f1c35..ac02d26 100755 --- a/osync.sh +++ b/osync.sh @@ -3,8 +3,8 @@ PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" -PROGRAM_VERSION=1.00 -PROGRAM_BUILD=2015072001 +PROGRAM_VERSION=1.1-dev +PROGRAM_BUILD=2015073101 ## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode if ! type -p "$BASH" > /dev/null @@ -687,6 +687,48 @@ _canonicalize_file_path() { (cd "$dir" 2>/dev/null && printf '%s/%s\n' "$(pwd -P)" "$file") } +# Optionally, you may also want to include: + +### readlink emulation ### + +readlink() { + if _has_command readlink; then + _system_readlink "$@" + else + _emulated_readlink "$@" + fi +} + +_has_command() { + hash -- "$1" 2>/dev/null +} + +_system_readlink() { + command readlink "$@" +} + +_emulated_readlink() { + if [ "$1" = -- ]; then + shift + fi + + _gnu_stat_readlink "$@" || _bsd_stat_readlink "$@" +} + +_gnu_stat_readlink() { + local output + output=$(stat -c %N -- "$1" 2>/dev/null) && + + printf '%s\n' "$output" | + sed "s/^‘[^’]*’ -> ‘\(.*\)’/\1/ + s/^'[^']*' -> '\(.*\)'/\1/" + # FIXME: handle newlines +} + +_bsd_stat_readlink() { + stat -f %Y -- "$1" 2>/dev/null +} + ### Specfic Osync function function CreateOsyncDirs