Merge from dev-1.1

This commit is contained in:
deajan 2015-09-08 12:40:42 +02:00
commit 35f02948cf
3 changed files with 49 additions and 4 deletions

View File

@ -7,6 +7,8 @@ RECENT CHANGES
-------------- --------------
- Added LSB info to init script for Debian based distros - 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 - Small improvements in osync-batch.sh time management
- Improved various logging on error - Improved various logging on error
- Work in progress: Unit tests (intial tests written by onovy, Thanks again!) - Work in progress: Unit tests (intial tests written by onovy, Thanks again!)

View File

@ -3,7 +3,7 @@
PROGRAM="Osync-batch" # Batch program to run osync instances sequentially and rerun failed ones PROGRAM="Osync-batch" # Batch program to run osync instances sequentially and rerun failed ones
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_BUILD=2015042501 PROGRAM_BUILD=2015082501
## Runs an osync instance for every conf file found ## Runs an osync instance for every conf file found
## If an instance fails, run it again if time permits ## 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 "--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-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 "--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 "--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 "--silent Will run osync without any output to stdout, used for cron jobs"
echo "--verbose Increases output" echo "--verbose Increases output"
@ -154,7 +155,7 @@ do
--max-exec-time=*) --max-exec-time=*)
MAX_EXECUTION_TIME=${i##*=} MAX_EXECUTION_TIME=${i##*=}
;; ;;
--help|-h) --help|-h|-?)
Usage Usage
;; ;;
*) *)

View File

@ -3,8 +3,8 @@
PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.00 PROGRAM_VERSION=1.1-dev
PROGRAM_BUILD=2015072001 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 ## 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 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") (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 ### Specfic Osync function
function CreateOsyncDirs function CreateOsyncDirs