Emulate earlier batch behavior by adding maxdepth 1 to find

This commit is contained in:
deajan 2016-12-03 09:34:26 +01:00
parent 3f278173c1
commit 569d5f63a2
1 changed files with 3 additions and 3 deletions

View File

@ -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=2016120102 PROGRAM_BUILD=2016120301
## 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
@ -95,13 +95,13 @@ function Batch {
else else
# Ugly hack to read files into an array while preserving special characters # Ugly hack to read files into an array while preserving special characters
runList=() runList=()
while IFS= read -d $'\0' -r file; do runList+=("$file"); done < <(find "$CONF_FILE_PATH" -iname "*.conf" -print0) while IFS= read -d $'\0' -r file; do runList+=("$file"); done < <(find "$CONF_FILE_PATH" -maxdepth 1 -iname "*.conf" -print0)
while ([ $MAX_EXECUTION_TIME -gt $SECONDS ] || [ $MAX_EXECUTION_TIME -eq 0 ]) && [ "${#runList[@]}" -gt 0 ] && [ $runs -le $MAX_RUNS ]; do while ([ $MAX_EXECUTION_TIME -gt $SECONDS ] || [ $MAX_EXECUTION_TIME -eq 0 ]) && [ "${#runList[@]}" -gt 0 ] && [ $runs -le $MAX_RUNS ]; do
runAgainList=() runAgainList=()
Logger "Sequential run n°$runs of $SUBPROGRAM instances for:" "NOTICE" Logger "Sequential run n°$runs of $SUBPROGRAM instances for:" "NOTICE"
for confFile in "${runList[@]}"; do for confFile in "${runList[@]}"; do
Logger "$confFile" "NOTICE" Logger "$(basename $confFile)" "NOTICE"
done done
for confFile in "${runList[@]}"; do for confFile in "${runList[@]}"; do
$SUBPROGRAM_EXECUTABLE "$confFile" --silent $opts & $SUBPROGRAM_EXECUTABLE "$confFile" --silent $opts &