diff options
Diffstat (limited to 'scripts/start-sim')
-rwxr-xr-x | scripts/start-sim | 63 |
1 files changed, 39 insertions, 24 deletions
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}" | |||
11 | tmux_send="${tmux_command} send-keys -t ${tmux_session}" | 11 | tmux_send="${tmux_command} send-keys -t ${tmux_session}" |
12 | bindir="${PRGDIR}/../bin" | 12 | bindir="${PRGDIR}/../bin" |
13 | date=$(date '+%F_%T') | 13 | date=$(date '+%F_%T') |
14 | all="" | ||
14 | delay=60 | 15 | delay=60 |
15 | quiet="" | 16 | quiet="" |
16 | waiting="" | 17 | waiting="" |
@@ -32,6 +33,12 @@ else | |||
32 | SUDO="sudo -Hu ${OS_USER}" | 33 | SUDO="sudo -Hu ${OS_USER}" |
33 | fi | 34 | fi |
34 | 35 | ||
36 | if [ "$1" = "-a" ] | ||
37 | then | ||
38 | all="-a" | ||
39 | shift 1 | ||
40 | fi | ||
41 | |||
35 | if [ "$1" = "-d" ] | 42 | if [ "$1" = "-d" ] |
36 | then | 43 | then |
37 | delay=$2 | 44 | delay=$2 |
@@ -52,31 +59,35 @@ fi | |||
52 | 59 | ||
53 | if [ "x$1" = "x" ]; then | 60 | if [ "x$1" = "x" ]; then |
54 | tgt=$(basename $(pwd)) | 61 | tgt=$(basename $(pwd)) |
62 | # These checks are kludgy. | ||
55 | if [ "$tgt" = "scripts" ]; then | 63 | if [ "$tgt" = "scripts" ]; then |
64 | all="-a" | ||
65 | cd ${PRGDIR}/../../config/ROBUST | ||
66 | tgt="ROBUST" | ||
67 | fi | ||
68 | if [ "$tgt" = "bin" ]; then | ||
56 | uptime | 69 | uptime |
57 | pushd ${PRGDIR}/../../config/ROBUST >/dev/null | 70 | wait_for_text "ROBUST" "INITIALIZATION COMPLETE FOR ROBUST" |
58 | ./start-sim -q | 71 | if [ ! "x$all" = "x" ] |
59 | popd > /dev/null | 72 | then |
60 | echo "Sleeping for $((${delay} / 2)) seconds." | 73 | echo "Sleeping for $((${delay} / 2)) seconds." |
61 | sleep $((${delay} / 2)) | 74 | sleep $((${delay} / 2)) |
62 | for i in $(seq -w 1 99) | 75 | for i in $(seq -w 1 99) |
63 | do | 76 | do |
64 | j=$(num2name ${i}) | 77 | if [ -e "${PRGDIR}/../../config/sim${i}" ] |
65 | if [ -e "${PRGDIR}/../../config/${j}" ] | 78 | then |
66 | then | 79 | uptime |
67 | uptime | 80 | echo "Starting sim${i}." |
68 | echo "Starting ${j}." | 81 | cd ${PRGDIR}/../../config/sim${i}; ./start-sim -w |
69 | pushd ${PRGDIR}/../../config/${j} >/dev/null | 82 | uptime |
70 | ./start-sim -w | 83 | # Sleep for a while, so that there is plenty of time to finish starting scripts and such, |
71 | popd > /dev/null | 84 | # and we are not keeping the computer very busy if there are lots of sims. |
72 | uptime | 85 | echo "Sleeping for ${delay} seconds." |
73 | # Sleep for a while, so that there is plenty of time to finish starting scripts and such, | 86 | sleep ${delay} |
74 | # and we are not keeping the computer very busy if there are lots of sims. | 87 | fi |
75 | echo "Sleeping for ${delay} seconds." | 88 | done |
76 | sleep ${delay} | 89 | uptime |
77 | fi | 90 | fi |
78 | done | ||
79 | uptime | ||
80 | exit 0 | 91 | exit 0 |
81 | fi | 92 | fi |
82 | num="$(echo ${tgt} | cut -c 4-)" | 93 | num="$(echo ${tgt} | cut -c 4-)" |
@@ -139,6 +150,11 @@ case $(basename $0) in | |||
139 | fi | 150 | fi |
140 | fi | 151 | fi |
141 | 152 | ||
153 | if [ ! "x$all" = "x" ] | ||
154 | then | ||
155 | ${tmux_send}:ROBUST.{left} "../scripts/start-sim -a" Enter | ||
156 | fi | ||
157 | |||
142 | if [ "x$quiet" = "x" ] | 158 | if [ "x$quiet" = "x" ] |
143 | then | 159 | then |
144 | if [ "x$tgt" = "xROBUST" ]; then | 160 | if [ "x$tgt" = "xROBUST" ]; then |
@@ -150,7 +166,6 @@ case $(basename $0) in | |||
150 | then | 166 | then |
151 | wait_for_text "${title}" "INITIALIZATION COMPLETE FOR ${title}" | 167 | wait_for_text "${title}" "INITIALIZATION COMPLETE FOR ${title}" |
152 | fi | 168 | fi |
153 | |||
154 | ;; | 169 | ;; |
155 | 170 | ||
156 | "backup-inventory") | 171 | "backup-inventory") |