diff -r a2342f26c9de -r b0b56e0f8c7f dev/provisioning/modules/puppi/files/scripts/wait.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dev/provisioning/modules/puppi/files/scripts/wait.sh Fri Jan 15 15:35:00 2016 +0100 @@ -0,0 +1,54 @@ +#!/bin/bash +# wait.sh - Made for Puppi + +# Sources common header for Puppi scripts +. $(dirname $0)/header || exit 10 + +# Show help +showhelp () { + echo "This script is used to introduce pauses during the deploy workflow" + echo + echo "It has the following options:" + echo "-s - The number of seconds to wait" + echo "-p - Wait until filename is present" + echo "-a - Wait until filename is absent" + echo "-f - Wait until is found the pattern in the filename" +} + +while [ $# -gt 0 ]; do + case "$1" in + -s) + sleep $2 + exit 0 + ;; + -p) + while true + do + [ -e $2 ] && break + sleep 1 + done + exit 0 + ;; + -a) + while true + do + [ ! -e $2 ] && break + sleep 1 + done + exit 0 + ;; + -f) + while true + do + grep $2 $3 && break + sleep 1 + done + exit 0 + ;; + *) + showhelp + exit + ;; + esac +done +