make tail stop when stack.sh is finished
This commit is contained in:
parent
9ff71acb08
commit
25369c914a
1 changed files with 35 additions and 14 deletions
|
@ -35,6 +35,7 @@ CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1}
|
||||||
NAMESERVER=${NAMESERVER:-$CONTAINER_GATEWAY}
|
NAMESERVER=${NAMESERVER:-$CONTAINER_GATEWAY}
|
||||||
COPYENV=${COPYENV:-1}
|
COPYENV=${COPYENV:-1}
|
||||||
DEST=${DEST:-/opt/stack}
|
DEST=${DEST:-/opt/stack}
|
||||||
|
WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
|
||||||
|
|
||||||
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
|
# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova"
|
||||||
STACKSH_PARAMS=${STACKSH_PARAMS:-}
|
STACKSH_PARAMS=${STACKSH_PARAMS:-}
|
||||||
|
@ -260,6 +261,7 @@ fi
|
||||||
# Start our container
|
# Start our container
|
||||||
lxc-start -d -n $CONTAINER
|
lxc-start -d -n $CONTAINER
|
||||||
|
|
||||||
|
if [ "$WAIT_TILL_LAUNCH" = "1" ]; then
|
||||||
# Done creating the container, let's tail the log
|
# Done creating the container, let's tail the log
|
||||||
echo
|
echo
|
||||||
echo "============================================================="
|
echo "============================================================="
|
||||||
|
@ -275,4 +277,23 @@ while [ ! -e "$ROOTFS/$DEST/run.sh.log" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
tail -F $ROOTFS/$DEST/run.sh.log
|
tail -F $ROOTFS/$DEST/run.sh.log &
|
||||||
|
|
||||||
|
TAIL_PID=$!
|
||||||
|
|
||||||
|
function kill_tail() {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Let Ctrl-c kill tail and exit
|
||||||
|
trap kill_tail SIGINT
|
||||||
|
|
||||||
|
echo "Waiting stack.sh to finish..."
|
||||||
|
while ! cat $ROOTFS/$DEST/run.sh.log | grep -q 'All done' ; do
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
kill $TAIL_PID
|
||||||
|
echo ""
|
||||||
|
echo "Finished - Zip-a-dee Doo-dah!"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue