aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-07 00:43:03 +1000
committerDavid Walter Seikel2012-02-07 00:43:03 +1000
commit39cfe220fb648c276d5da497b1ebdea998c3a7e2 (patch)
treeafa7610a162e6937165eecefccf56b8c8d6bb6bf
parentStopping after 5 tries to restart the sim is not so good. (diff)
downloadIGnoble-39cfe220fb648c276d5da497b1ebdea998c3a7e2.zip
IGnoble-39cfe220fb648c276d5da497b1ebdea998c3a7e2.tar.gz
IGnoble-39cfe220fb648c276d5da497b1ebdea998c3a7e2.tar.bz2
IGnoble-39cfe220fb648c276d5da497b1ebdea998c3a7e2.tar.xz
Double check if the sim is REALLY running.
-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