aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xstart-sim19
1 files changed, 12 insertions, 7 deletions
diff --git a/start-sim b/start-sim
index df66790..503d547 100755
--- a/start-sim
+++ b/start-sim
@@ -9,6 +9,13 @@ osversion="current"
9bindir=/opt/opensim/${osversion}/bin 9bindir=/opt/opensim/${osversion}/bin
10quiet="" 10quiet=""
11 11
12if [ $USER = "opensim" ]
13then
14 SUDO=""
15else
16 SUDO="sudo -Hu opensim"
17fi
18
12if [ "$1" = "-q" ] 19if [ "$1" = "-q" ]
13then 20then
14 quiet="true" 21 quiet="true"
@@ -39,12 +46,6 @@ cd ${bindir}
39if ( ${screen_command} -q list-sessions 2>/dev/null | grep -q ${console_name}: ); then 46if ( ${screen_command} -q list-sessions 2>/dev/null | grep -q ${console_name}: ); then
40 true 47 true
41else 48else
42 if [ $USER = "opensim" ]
43 then
44 SUDO=""
45 else
46 SUDO="sudo -Hu opensim"
47 fi
48 # The sudo is only so that the session is owned by opensim, otherwise it's owned by whoewer ran this script, which is a likely security hole. 49 # The sudo is only so that the session is owned by opensim, otherwise it's owned by whoewer ran this script, which is a likely security hole.
49 # After the session is created, we rely on the /var/run/opensim directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. 50 # After the session is created, we rely on the /var/run/opensim directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket.
50 $SUDO ${screen_command} new-session -d -s ${console_name} 51 $SUDO ${screen_command} new-session -d -s ${console_name}
@@ -76,7 +77,11 @@ case $(basename $0) in
76 # Check if it's already running. 77 # Check if it's already running.
77 if [ ! -e /var/run/opensim/${tgt}.pid ] 78 if [ ! -e /var/run/opensim/${tgt}.pid ]
78 then 79 then
79 ${screen_command} new-window -dn "[${title}]" -t "${screen_session}" "${cmd}" 80 # Double check if it's REALLY running.
81 if [ "x$(ps -p $(cat /var/run/opensim/sim90.pid) --no-headers -o comm)" = "x" ]; then
82 $SUDO rm -f /var/run/opensim/${tgt}.pid
83 ${screen_command} new-window -dn "[${title}]" -t "${screen_session}" "${cmd}"
84 fi
80 fi 85 fi
81 ;& 86 ;&
82 87