From ae3d4c0e418bb74b9ca0d3cbfa86d8abbc976d30 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 5 Aug 2019 04:18:58 +1000 Subject: Running start-sim in scripts now starts everything up, with a delay. --- scripts/start-sim | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'scripts') 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}" tmux_send="${tmux_command} send-keys -t ${tmux_session}" bindir="${PRGDIR}/../bin" date=$(date '+%F_%T') +delay=60 quiet="" waiting="" inventory="" @@ -31,12 +32,18 @@ else SUDO="sudo -Hu ${OS_USER}" fi +if [ "$1" = "-d" ] +then + delay=$2 + shift 2 +fi + if [ "$1" = "-q" ] then quiet="true" shift 1 fi - + if [ "$1" = "-w" ] then waiting="true" @@ -45,6 +52,33 @@ fi if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) + if [ "$tgt" = "scripts" ]; then + uptime + pushd ${PRGDIR}/../../config/ROBUST >/dev/null + ./start-sim -w + echo "Sleeping for $((${delay} / 2)) seconds." + sleep $((${delay} / 2)) + popd > /dev/null + 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 + 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} + popd > /dev/null + fi + done + uptime + exit 0 + fi num="$(echo ${tgt} | cut -c 4-)" elif [ -d "$1" ]; then tgt=$1 @@ -70,7 +104,7 @@ if ( ${tmux_command} -q list-sessions 2>/dev/null | grep -q ${console_name}: ); else # 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. # 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. - $SUDO ${tmux_command} new-session -d -s ${console_name} -n "Server" + $SUDO ${tmux_command} new-session -d -s ${console_name} -n "ROBUST" fi -- cgit v1.1