From 512d0ec0b841d98a39f0749de42b2f34743ab5ac Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 20 Jul 2014 22:51:56 +0100 Subject: [PATCH] Configurable sleep value. Fixes #413 Support a configurable sleep time when starting, restart and checking for enabled service. --- bootstrap-salt.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3407bc2..c2804ab 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -44,6 +44,9 @@ __ScriptName="bootstrap-salt.sh" BS_TRUE=1 BS_FALSE=0 +# Default sleep time used when waiting for daemons to start, restart and checking for these running +__DEFAULT_SLEEP=3 + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __detect_color_support # DESCRIPTION: Try to detect color support. @@ -202,6 +205,8 @@ usage() { -g Salt repository URL. (default: git://github.com/saltstack/salt.git) -k Temporary directory holding the minion keys which will pre-seed the master. + -s Sleep time used when waiting for daemons to start, restart and when checking + for the services running. Default: ${__DEFAULT_SLEEP} -M Also install salt-master -S Also install salt-syndic -N Do not install salt-minion @@ -4604,8 +4609,8 @@ fi # Run any start daemons function if [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then echoinfo "Running ${STARTDAEMONS_INSTALL_FUNC}()" - echodebug "Waiting 3 seconds for processes to settle before checking for them" - sleep 3 + echodebug "Waiting ${__DEFAULT_SLEEP} seconds for processes to settle before checking for them" + sleep ${__DEFAULT_SLEEP} $STARTDAEMONS_INSTALL_FUNC if [ $? -ne 0 ]; then echoerror "Failed to run ${STARTDAEMONS_INSTALL_FUNC}()!!!" @@ -4616,8 +4621,8 @@ fi # Check if the installed daemons are running or not if [ "$DAEMONS_RUNNING_FUNC" != "null" ] && [ $_START_DAEMONS -eq $BS_TRUE ]; then echoinfo "Running ${DAEMONS_RUNNING_FUNC}()" - echodebug "Waiting 3 seconds for processes to settle before checking for them" - sleep 3 # Sleep a little bit to let daemons start + echodebug "Waiting ${__DEFAULT_SLEEP} seconds for processes to settle before checking for them" + sleep ${__DEFAULT_SLEEP} # Sleep a little bit to let daemons start $DAEMONS_RUNNING_FUNC if [ $? -ne 0 ]; then echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!"