From c25dbbfc4447898fac20ab58a8e74bb5a6ee5f76 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 13 Aug 2019 01:01:56 +1000 Subject: Modify start-sim to start up everything, with the output in the left tmux window. --- scripts/start-sim | 63 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index bf6a32e..3e03911 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -11,6 +11,7 @@ tmux_window="${tmux_command} select-window -t ${tmux_session}" tmux_send="${tmux_command} send-keys -t ${tmux_session}" bindir="${PRGDIR}/../bin" date=$(date '+%F_%T') +all="" delay=60 quiet="" waiting="" @@ -32,6 +33,12 @@ else SUDO="sudo -Hu ${OS_USER}" fi +if [ "$1" = "-a" ] +then + all="-a" + shift 1 +fi + if [ "$1" = "-d" ] then delay=$2 @@ -52,31 +59,35 @@ fi if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) + # These checks are kludgy. if [ "$tgt" = "scripts" ]; then + all="-a" + cd ${PRGDIR}/../../config/ROBUST + tgt="ROBUST" + fi + if [ "$tgt" = "bin" ]; then uptime - pushd ${PRGDIR}/../../config/ROBUST >/dev/null - ./start-sim -q - popd > /dev/null - echo "Sleeping for $((${delay} / 2)) seconds." - sleep $((${delay} / 2)) - for i in $(seq -w 1 99) - do - j=$(num2name ${i}) - if [ -e "${PRGDIR}/../../config/${j}" ] - then - uptime - echo "Starting ${j}." - pushd ${PRGDIR}/../../config/${j} >/dev/null - ./start-sim -w - popd > /dev/null - uptime - # Sleep for a while, so that there is plenty of time to finish starting scripts and such, - # and we are not keeping the computer very busy if there are lots of sims. - echo "Sleeping for ${delay} seconds." - sleep ${delay} - fi - done - uptime + wait_for_text "ROBUST" "INITIALIZATION COMPLETE FOR ROBUST" + if [ ! "x$all" = "x" ] + then + echo "Sleeping for $((${delay} / 2)) seconds." + sleep $((${delay} / 2)) + for i in $(seq -w 1 99) + do + if [ -e "${PRGDIR}/../../config/sim${i}" ] + then + uptime + echo "Starting sim${i}." + cd ${PRGDIR}/../../config/sim${i}; ./start-sim -w + uptime + # Sleep for a while, so that there is plenty of time to finish starting scripts and such, + # and we are not keeping the computer very busy if there are lots of sims. + echo "Sleeping for ${delay} seconds." + sleep ${delay} + fi + done + uptime + fi exit 0 fi num="$(echo ${tgt} | cut -c 4-)" @@ -139,6 +150,11 @@ case $(basename $0) in fi fi + if [ ! "x$all" = "x" ] + then + ${tmux_send}:ROBUST.{left} "../scripts/start-sim -a" Enter + fi + if [ "x$quiet" = "x" ] then if [ "x$tgt" = "xROBUST" ]; then @@ -150,7 +166,6 @@ case $(basename $0) in then wait_for_text "${title}" "INITIALIZATION COMPLETE FOR ${title}" fi - ;; "backup-inventory") -- cgit v1.1