aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/start-sim38
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}"
11tmux_send="${tmux_command} send-keys -t ${tmux_session}" 11tmux_send="${tmux_command} send-keys -t ${tmux_session}"
12bindir="${PRGDIR}/../bin" 12bindir="${PRGDIR}/../bin"
13date=$(date '+%F_%T') 13date=$(date '+%F_%T')
14delay=60
14quiet="" 15quiet=""
15waiting="" 16waiting=""
16inventory="" 17inventory=""
@@ -31,12 +32,18 @@ else
31 SUDO="sudo -Hu ${OS_USER}" 32 SUDO="sudo -Hu ${OS_USER}"
32fi 33fi
33 34
35if [ "$1" = "-d" ]
36then
37 delay=$2
38 shift 2
39fi
40
34if [ "$1" = "-q" ] 41if [ "$1" = "-q" ]
35then 42then
36 quiet="true" 43 quiet="true"
37 shift 1 44 shift 1
38fi 45fi
39 46
40if [ "$1" = "-w" ] 47if [ "$1" = "-w" ]
41then 48then
42 waiting="true" 49 waiting="true"
@@ -45,6 +52,33 @@ fi
45 52
46if [ "x$1" = "x" ]; then 53if [ "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-)"
49elif [ -d "$1" ]; then 83elif [ -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}: );
70else 104else
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"
74fi 108fi
75 109
76 110