From c00a00525c3eee15b3c93a012709c1d7a1bb0a53 Mon Sep 17 00:00:00 2001 From: deajan Date: Tue, 25 Aug 2015 15:41:00 +0200 Subject: [PATCH] Another quick fix comming from osync --- CHANGELOG.md | 3 ++- obackup-batch.sh | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e920d1c..31396e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,8 +22,9 @@ UNDER WORK CHANGELOG --------- - Backported some fixes from Osync - - Small improvments on install script + - Small improvements on install script - Copy ssh_filter.sh from osync project + - Small improvements in obackup-batch.sh time management - Quick and dirty hack to get the full last run log in SendAlert email - Added detection of obackup.sh script in obackup-batch.sh to overcome mising path in crontab - Moved command line arguments after config file load for allowing command line overrides diff --git a/obackup-batch.sh b/obackup-batch.sh index d877fc0..72d1d59 100755 --- a/obackup-batch.sh +++ b/obackup-batch.sh @@ -3,7 +3,7 @@ PROGRAM="Obackup-batch" # Batch program to run obackup instances sequentially and rerun failed ones AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" -PROGRAM_BUILD=2504201501 +PROGRAM_BUILD=2508201501 ## Runs an obackup instance for every conf file found ## If an instance fails, run it again if time permits @@ -56,6 +56,13 @@ function CheckEnvironment else OBACKUP_EXECUTABLE=$(type -p obackup.sh) fi + + ## Check for CONF_FILE_PATH + if [ ! -d "$CONF_FILE_PATH" ] + then + Log "Cannot find conf file path $CONF_FILE_PATH" + Usage + fi } function Batch @@ -72,7 +79,7 @@ function Batch done RERUNS=0 - while [ $MAX_EXECUTION_TIME -gt $SECONDS ] && [ "$RUN" != "" ] && [ $MAX_RERUNS -gt $RERUNS ] + while ([ $MAX_EXECUTION_TIME -gt $SECONDS ] || [ $MAX_EXECUTION_TIME -eq 0 ]) && [ "$RUN" != "" ] && [ $MAX_RERUNS -gt $RERUNS ] do Log "Obackup instances will be run for: $RUN" for i in $RUN @@ -110,6 +117,7 @@ function Usage echo "--path=/path/to/conf Path to obackup conf files, defaults to /etc/obackup" 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)" + echo "--no-maxtime Run obackup without honoring conf file defined timeouts" echo "--dry Will run obackup without actually doing anything; just testing" echo "--silent Will run obackup without any output to stdout, used for cron jobs" echo "--verbose Increases output" @@ -135,6 +143,9 @@ do verbose=1 opts=$opts" --verbose" ;; + --no-maxtime) + opts=$opts" --no-maxtime" + ;; --path=*) CONF_FILE_PATH=${i##*=} ;; @@ -144,7 +155,7 @@ do --max-exec-time=*) MAX_EXECUTION_TIME=${i##*=} ;; - --help|-h) + --help|-h|-?) Usage ;; *)