diff options
-rwxr-xr-x | scripts/start-sim | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/scripts/start-sim b/scripts/start-sim index 9f0a916..8b8fef3 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 | delay=60 | ||
14 | quiet="" | 15 | quiet="" |
15 | waiting="" | 16 | waiting="" |
16 | inventory="" | 17 | inventory="" |
@@ -31,12 +32,18 @@ else | |||
31 | SUDO="sudo -Hu ${OS_USER}" | 32 | SUDO="sudo -Hu ${OS_USER}" |
32 | fi | 33 | fi |
33 | 34 | ||
35 | if [ "$1" = "-d" ] | ||
36 | then | ||
37 | delay=$2 | ||
38 | shift 2 | ||
39 | fi | ||
40 | |||
34 | if [ "$1" = "-q" ] | 41 | if [ "$1" = "-q" ] |
35 | then | 42 | then |
36 | quiet="true" | 43 | quiet="true" |
37 | shift 1 | 44 | shift 1 |
38 | fi | 45 | fi |
39 | 46 | ||
40 | if [ "$1" = "-w" ] | 47 | if [ "$1" = "-w" ] |
41 | then | 48 | then |
42 | waiting="true" | 49 | waiting="true" |
@@ -45,6 +52,33 @@ fi | |||
45 | 52 | ||
46 | if [ "x$1" = "x" ]; then | 53 | if [ "x$1" = "x" ]; then |
47 | tgt=$(basename $(pwd)) | 54 | tgt=$(basename $(pwd)) |
55 | if [ "$tgt" = "scripts" ]; then | ||
56 | uptime | ||
57 | pushd ${PRGDIR}/../../config/ROBUST >/dev/null | ||
58 | ./start-sim -w | ||
59 | echo "Sleeping for $((${delay} / 2)) seconds." | ||
60 | sleep $((${delay} / 2)) | ||
61 | popd > /dev/null | ||
62 | for i in $(seq -w 1 99) | ||
63 | do | ||
64 | j=$(num2name ${i}) | ||
65 | if [ -e "${PRGDIR}/../../config/${j}" ] | ||
66 | then | ||
67 | uptime | ||
68 | echo "Starting ${j}." | ||
69 | pushd ${PRGDIR}/../../config/${j} >/dev/null | ||
70 | ./start-sim -w | ||
71 | uptime | ||
72 | # Sleep for a while, so that there is plenty of time to finish starting scripts and such, | ||
73 | # and we are not keeping the computer very busy if there are lots of sims. | ||
74 | echo "Sleeping for ${delay} seconds." | ||
75 | sleep ${delay} | ||
76 | popd > /dev/null | ||
77 | fi | ||
78 | done | ||
79 | uptime | ||
80 | exit 0 | ||
81 | fi | ||
48 | num="$(echo ${tgt} | cut -c 4-)" | 82 | num="$(echo ${tgt} | cut -c 4-)" |
49 | elif [ -d "$1" ]; then | 83 | elif [ -d "$1" ]; then |
50 | tgt=$1 | 84 | tgt=$1 |
@@ -70,7 +104,7 @@ if ( ${tmux_command} -q list-sessions 2>/dev/null | grep -q ${console_name}: ); | |||
70 | else | 104 | else |
71 | # The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. | 105 | # The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. |
72 | # After the session is created, we rely on the ${PRGDIR}/../../caches/ directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. | 106 | # After the session is created, we rely on the ${PRGDIR}/../../caches/ directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. |
73 | $SUDO ${tmux_command} new-session -d -s ${console_name} -n "Server" | 107 | $SUDO ${tmux_command} new-session -d -s ${console_name} -n "ROBUST" |
74 | fi | 108 | fi |
75 | 109 | ||
76 | 110 | ||