aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/start-sim-in-rest
diff options
context:
space:
mode:
authorDavid Walter Seikel2011-11-26 14:35:08 +1000
committerDavid Walter Seikel2011-11-26 14:35:08 +1000
commit4a1156f2802bda785e67a58893ba74517b672cc6 (patch)
tree7d1f2c68a286f06cbc66b973c2a81ef1ef3c8827 /start-sim-in-rest
parentFixing typos one letter at a time. Added a word to, making this one slightly... (diff)
downloadIGnoble-4a1156f2802bda785e67a58893ba74517b672cc6.zip
IGnoble-4a1156f2802bda785e67a58893ba74517b672cc6.tar.gz
IGnoble-4a1156f2802bda785e67a58893ba74517b672cc6.tar.bz2
IGnoble-4a1156f2802bda785e67a58893ba74517b672cc6.tar.xz
Added screen support, plus some tweaks.
Diffstat (limited to 'start-sim-in-rest')
-rwxr-xr-xstart-sim-in-rest73
1 files changed, 60 insertions, 13 deletions
diff --git a/start-sim-in-rest b/start-sim-in-rest
index d6aac2c..4738c2e 100755
--- a/start-sim-in-rest
+++ b/start-sim-in-rest
@@ -1,40 +1,87 @@
1#!/bin/bash 1#!/bin/bash
2 2
3osversion="current" 3# Pick one of these depending on how you want your access.
4NeedARest=" -console=rest" 4# NOTE - REST does not work. B-(
5#NeedARest=" -console=rest"
5NeedARest="" 6NeedARest=""
7Screaming="true"
8#Screaming=""
9
10USER=$(whoami)
11
12console_name=screen_console
13if [ "$USER" = "opensim" ]
14then
15 screen_session=opensim/${console_name}
16 screen_check="screen -ls opensim/"
17else
18 screen_session=${console_name}
19 screen_check="screen -ls"
20fi
21osversion="current"
6 22
7if [ x$1 = x ]; then 23if [ "x$1" = "x" ]; then
8 pathname=$(pwd) 24 pathname=$(pwd)
9 tgt=$(basename $pathname) 25 tgt=$(basename $pathname)
10elif [ -d ./$1 ]; then 26elif [ -d "./$1" ]; then
11 tgt=$1 27 tgt=$1
12elif [ -d ./sim$1 ]; then 28elif [ -d "./sim$1" ]; then
13 tgt=sim$1 29 tgt=sim$1
14fi 30fi
15 31
16if [ x$tgt = x ]; then 32if [ "x$tgt" = "x" ]; then
17 echo "usage:" 33 echo "usage:"
18 echo " $ start-sim-in-rest <sim>" 34 echo " $ start-sim-in-rest <sim>"
19 echo "where <sim> is one of: " robust sim[0-9][0-9] 35 echo "where <sim> is one of: " robust sim[0-9][0-9]
20 exit 1 36 exit 1
21fi 37fi
22 38
23inidir=/opt/opensim/config/${tgt} 39if [ "x$Screaming" = "xtrue" ]
24bindir=/opt/opensim/${osversion}/bin 40then
25if [ x$tgt = xrobust ]; then 41 if ($screen_check | grep -q ${console_name}); then
42 echo "INFO: Screen already running"
43 true
44 else
45 echo "DEBUG: Starting screen"
46 screen -d -m -S ${console_name}
47 fi
48fi
49
50if [ "x$tgt" = "xrobust" ]; then
26 exe="Robust" 51 exe="Robust"
27else 52else
28 exe="OpenSim" 53 exe="OpenSim"
29fi 54fi
55inidir=/opt/opensim/config/${tgt}
56bindir=/opt/opensim/${osversion}/bin
57cmd="/usr/bin/mono ${exe}.exe -inidirectory=${inidir} -logconfig=${inidir}/${exe}.exe.config $NeedARest"
30 58
59# Check if it's already running.
31if [ ! -e /var/run/opensim/${tgt} ] 60if [ ! -e /var/run/opensim/${tgt} ]
32then 61then
33 cd ${bindir} 62 if [ "x$Screaming" = "xtrue" ]
34 /usr/bin/mono ${exe}.exe -inidirectory=${inidir} -logconfig=${inidir}/${exe}.exe.config $NeedARest 63 then
64 tmpfile=`mktemp`
65 echo "chdir ${bindir}" > ${tmpfile}
66 echo "screen -t ${tgt} ${cmd}" >> ${tmpfile}
67 chmod a+r ${tmpfile}
68 rm -f ${inidir}/start.screen
69 cp ${tmpfile} ${inidir}/start.screen
70 rm ${tmpfile}
71 # echo "INFO: start process and connect to screen (opensim)"
72 screen -r ${screen_session} -p "-" -X source ${inidir}/start.screen
73 else
74 cd ${bindir}
75 $cmd
76 fi
35fi 77fi
36 78
37if [ "x$NeedARest" = x } 79# Either way, need to start up the console after.
80if [ "x$Screaming" = "xtrue" ]
81then
82 echo "Starting screen client."
83 screen -r ${screen_session} -A
84elif [ "x$NeedARest" != "x" ]
38then 85then
39 echo "Starting rest client." 86 echo "Starting rest client."
40 cd ${inidir} 87 cd ${inidir}