aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/start-sim
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/start-sim')
-rwxr-xr-xscripts/start-sim24
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts/start-sim b/scripts/start-sim
index e82547a..3c6370f 100755
--- a/scripts/start-sim
+++ b/scripts/start-sim
@@ -4,8 +4,8 @@ source common.sh
4getPrgDir 4getPrgDir
5 5
6USER=$(whoami) 6USER=$(whoami)
7console_name="OpenSim_console" 7console_name="OpenSimSC_console"
8tmux_command="tmux -S /var/run/opensim/opensim-tmux.socket" 8tmux_command="tmux -S ${PRGDIR}/../../caches/opensim-tmux.socket"
9tmux_session=${console_name} 9tmux_session=${console_name}
10tmux_window="${tmux_command} select-window -t ${tmux_session}" 10tmux_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}"
@@ -22,11 +22,11 @@ function wait_for_text()
22 done 22 done
23} 23}
24 24
25if [ $USER = "opensim" ] 25if [ $USER = "${OS_USER}" ]
26then 26then
27 SUDO="" 27 SUDO=""
28else 28else
29 SUDO="sudo -Hu opensim" 29 SUDO="sudo -Hu ${OS_USER}"
30fi 30fi
31 31
32if [ "$1" = "-q" ] 32if [ "$1" = "-q" ]
@@ -80,7 +80,7 @@ case $(basename $0) in
80 cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} " 80 cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} "
81 81
82 # Check if it's already running. 82 # Check if it's already running.
83 if [ -e /var/run/opensim/${tgt}.pid ] 83 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]
84 then 84 then
85 # Double check if it's REALLY running. 85 # Double check if it's REALLY running.
86 if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then 86 if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then
@@ -88,12 +88,12 @@ case $(basename $0) in
88 fi 88 fi
89 fi 89 fi
90 # Now see if it's really really running. lol 90 # Now see if it's really really running. lol
91 if [ ! -e /var/run/opensim/${tgt}.pid ] 91 if [ ! -e ${PRGDIR}/../../caches/${tgt}.pid ]
92 then 92 then
93 if [ "x$tgt" = "xROBUST" ]; then 93 if [ "x$tgt" = "xROBUST" ]; then
94# TODO - the problem here is that the > bit is executed as onefang, not as opensim. 94# TODO - the problem here is that the > bit is executed as the user, not as opensim.
95 $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini 95 $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini
96# $SUDO chown -R opensim:opensim ${PRGDIR}/../../config/Robust.ini 96# $SUDO chown -R ${OS_USER}:${OS_USER} ${PRGDIR}/../../config/Robust.ini
97 chmod 640 ${PRGDIR}/../../config/Robust.ini 97 chmod 640 ${PRGDIR}/../../config/Robust.ini
98 ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" 98 ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}"
99 else 99 else
@@ -124,7 +124,7 @@ case $(basename $0) in
124 ;; 124 ;;
125 125
126 "backup-sim") 126 "backup-sim")
127 if [ -e /var/run/opensim/${tgt}.pid ]; then 127 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then
128 cd ${PRGDIR} 128 cd ${PRGDIR}
129 $SUDO ${PRGDIR}/gitAR.sh o "${title}" 129 $SUDO ${PRGDIR}/gitAR.sh o "${title}"
130 sim=$(sanitize "${title}") 130 sim=$(sanitize "${title}")
@@ -141,7 +141,7 @@ case $(basename $0) in
141 ;; 141 ;;
142 142
143 "stop-sim") 143 "stop-sim")
144 if [ -e /var/run/opensim/${tgt}.pid ]; then 144 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then
145 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter 145 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter
146 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter 146 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter
147 sleep 30 147 sleep 30
@@ -150,9 +150,9 @@ case $(basename $0) in
150 sleep 30 150 sleep 30
151 ${tmux_send}:"${title}" "shutdown" Enter 151 ${tmux_send}:"${title}" "shutdown" Enter
152 sleep 30 152 sleep 30
153 if [ -e /var/run/opensim/${tgt}.pid ]; then 153 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then
154 echo "Killing it with extreme prejudice!" 154 echo "Killing it with extreme prejudice!"
155 kill -TERM `cat /var/run/opensim/${tgt}.pid` 155 kill -TERM `cat ${PRGDIR}/../../caches/${tgt}.pid`
156 fi 156 fi
157 else 157 else
158 echo "Sim ${title} is not running, so not stopping." 158 echo "Sim ${title} is not running, so not stopping."