mirror of
https://github.com/deajan/obackup.git
synced 2024-12-26 15:33:41 +01:00
Improved batch runner
This commit is contained in:
parent
87dd096f61
commit
56173e9d1c
@ -10,9 +10,16 @@ CHANGELOG
|
|||||||
|
|
||||||
README: FreeBSD execution needs mailer (not found), sudo missing, bash needed, sed missing (see if StripQuotes mandatory)
|
README: FreeBSD execution needs mailer (not found), sudo missing, bash needed, sed missing (see if StripQuotes mandatory)
|
||||||
|
|
||||||
|
- Improved batch runner
|
||||||
|
- Batch runner works for directories and direct paths
|
||||||
|
- Fixed batch runner does not rerun obackup on warnings only
|
||||||
|
- Code compliance
|
||||||
|
- More clear semantic
|
||||||
|
! doc reruns
|
||||||
|
!- better explanation of max-reruns (is actually runs)
|
||||||
- Made keep logging value configurable and not mandatory
|
- Made keep logging value configurable and not mandatory
|
||||||
- Fixed handling of processes in uninterruptible sleep state
|
- Fixed handling of processes in uninterruptible sleep state
|
||||||
! -preserve options
|
! -preserve options (+preflight check)
|
||||||
- Code cleanup
|
- Code cleanup
|
||||||
- Refactored waiting functions
|
- Refactored waiting functions
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ SUBPROGRAM=[prgname]
|
|||||||
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones
|
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones
|
||||||
AUTHOR="(L) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(L) 2013-2016 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr - ozy@netpower.fr"
|
||||||
PROGRAM_BUILD=2016081701
|
PROGRAM_BUILD=2016081702Xo
|
||||||
|
|
||||||
## Runs an osync /obackup instance for every conf file found
|
## Runs an osync /obackup 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
|
||||||
@ -69,12 +69,6 @@ function CheckEnvironment {
|
|||||||
else
|
else
|
||||||
SUBPROGRAM_EXECUTABLE=$(type -p $SUBPROGRAM.sh)
|
SUBPROGRAM_EXECUTABLE=$(type -p $SUBPROGRAM.sh)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Check for CONF_FILE_PATH
|
|
||||||
if [ ! -d "$CONF_FILE_PATH" ]; then
|
|
||||||
Logger "Cannot find conf file path $CONF_FILE_PATH" "CRITICAL"
|
|
||||||
Usage
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Batch {
|
function Batch {
|
||||||
@ -85,8 +79,10 @@ function Batch {
|
|||||||
local confFile
|
local confFile
|
||||||
local result
|
local result
|
||||||
|
|
||||||
|
## Check for CONF_FILE_PATH
|
||||||
|
if [ -d "$CONF_FILE_PATH" ]; then
|
||||||
## Get list of .conf files
|
## Get list of .conf files
|
||||||
for confFile in "$CONF_FILE_PATH/*.conf"
|
for confFile in $CONF_FILE_PATH/*.conf
|
||||||
do
|
do
|
||||||
if [ "$runList" == "" ]; then
|
if [ "$runList" == "" ]; then
|
||||||
runList="$confFile"
|
runList="$confFile"
|
||||||
@ -94,6 +90,12 @@ function Batch {
|
|||||||
runList=$runList" $confFile"
|
runList=$runList" $confFile"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ -f "$CONF_FILE_PATH" ] && [ "${CONF_FILE_PATH##*.}" == "conf" ]; then
|
||||||
|
runList="$CONF_FILE_PATH"
|
||||||
|
else
|
||||||
|
Logger "Cannot find conf file path [$CONF_FILE_PATH]." "CRITICAL"
|
||||||
|
Usage
|
||||||
|
fi
|
||||||
|
|
||||||
while ([ $MAX_EXECUTION_TIME -gt $SECONDS ] || [ $MAX_EXECUTION_TIME -eq 0 ]) && [ "$runList" != "" ] && [ $MAX_RUNS -gt $runs ]
|
while ([ $MAX_EXECUTION_TIME -gt $SECONDS ] || [ $MAX_EXECUTION_TIME -eq 0 ]) && [ "$runList" != "" ] && [ $MAX_RUNS -gt $runs ]
|
||||||
do
|
do
|
||||||
@ -134,8 +136,8 @@ function Usage {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "[OPTIONS]"
|
echo "[OPTIONS]"
|
||||||
echo "--path=/path/to/conf Path to osync / obackup conf files, defaults to /etc/osync or /etc/obackup"
|
echo "--path=/path/to/conf Path to osync / obackup conf files, defaults to /etc/osync or /etc/obackup"
|
||||||
echo "--max-reruns=X Number of runs max for failed instances, (defaults to 3)"
|
echo "--max-runs=X Number of max runs per instance, (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 / obackup without honoring conf file defined timeouts"
|
echo "--no-maxtime Run osync / obackup without honoring conf file defined timeouts"
|
||||||
echo "--dry Will run osync / obackup without actually doing anything; just testing"
|
echo "--dry Will run osync / obackup without actually doing anything; just testing"
|
||||||
echo "--silent Will run osync / obackup without any output to stdout, used for cron jobs"
|
echo "--silent Will run osync / obackup without any output to stdout, used for cron jobs"
|
||||||
@ -162,8 +164,8 @@ do
|
|||||||
--path=*)
|
--path=*)
|
||||||
CONF_FILE_PATH=${i##*=}
|
CONF_FILE_PATH=${i##*=}
|
||||||
;;
|
;;
|
||||||
--max-reruns=*)
|
--max-runs=*)
|
||||||
MAX_RERUNS=${i##*=}
|
MAX_RUNS=${i##*=}
|
||||||
;;
|
;;
|
||||||
--max-exec-time=*)
|
--max-exec-time=*)
|
||||||
MAX_EXECUTION_TIME=${i##*=}
|
MAX_EXECUTION_TIME=${i##*=}
|
||||||
|
Loading…
Reference in New Issue
Block a user