aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-12-10 00:33:51 +1000
committerDavid Walter Seikel2016-12-10 00:33:51 +1000
commit07fd203c1a01ee83c6a7bb3726a718a4e463cd71 (patch)
treedd8ecb89fc00e5c843842475a71f41fc25d1a8a5 /scripts
parentUpdate .gitignore. (diff)
downloadopensim-SC_OLD-07fd203c1a01ee83c6a7bb3726a718a4e463cd71.zip
opensim-SC_OLD-07fd203c1a01ee83c6a7bb3726a718a4e463cd71.tar.gz
opensim-SC_OLD-07fd203c1a01ee83c6a7bb3726a718a4e463cd71.tar.bz2
opensim-SC_OLD-07fd203c1a01ee83c6a7bb3726a718a4e463cd71.tar.xz
Fix up creating sims.
Diffstat (limited to '')
-rwxr-xr-xscripts/create_sim.sh29
1 files changed, 18 insertions, 11 deletions
diff --git a/scripts/create_sim.sh b/scripts/create_sim.sh
index d82dcc7..0681067 100755
--- a/scripts/create_sim.sh
+++ b/scripts/create_sim.sh
@@ -1,21 +1,23 @@
1#!/bin/bash 1#!/bin/bash
2 2
3source common.sh
4getPrgDir
5
3NAME=$1 6NAME=$1
4LOCATION=$2 7LOCATION=$2
5URL=$3 8URL=$3
6IP=$4 9IP=$4
7SIZE=$5 10SIZE=$5
8 11
9
10OSPATH="/opt/opensim" 12OSPATH="/opt/opensim"
11cd $OSPATH/config 13cd $OSPATH/config
12 14
13k=0 15k=0
14for i in $(seq 50 99) 16for i in $(seq -w 1 99)
15do 17do
16 j=$(printf "sim%02d" $i) 18 j=$(num2name "$i")
17 if [ -e "$j" ] 19 if [ -e "$j" ]
18 then 20 then
19 k=$i 21 k=$i
20 fi 22 fi
21done 23done
@@ -26,7 +28,7 @@ then
26 echo "WARNING setting the sim name to [$NAME], this may not be what you want." 28 echo "WARNING setting the sim name to [$NAME], this may not be what you want."
27fi 29fi
28# Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. 30# Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows.
29sim=$(echo "${NAME}" | sed -e 's/[\\/:\*\?"<>\|@#$%&\0\x01-\x1F\x27\x40\x60\x7F. ]/_/g' -e 's/^$/NONAME/') 31sim=$(sanitize $NAME)
30 32
31if [ "x$LOCATION" = "x" ] 33if [ "x$LOCATION" = "x" ]
32then 34then
@@ -43,9 +45,9 @@ then
43# According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. 45# According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine.
44fi 46fi
45 47
46# Here we make use of an external IP finding service. Careful, it may move.
47if [ "x$URL" = "x" ] 48if [ "x$URL" = "x" ]
48then 49then
50# Here we make use of an external IP finding service. Careful, it may move.
49# URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. 51# URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too.
50 URL="SYSTEMIP" 52 URL="SYSTEMIP"
51 echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." 53 echo "WARNING setting the ExternalHostName to $URL, this may not be what you want."
@@ -56,8 +58,14 @@ then
56 SIZE="256" 58 SIZE="256"
57fi 59fi
58 60
59NUM=$(printf "%02d" $(($k + 1)) ) 61# Wow, the hoops we have to jump through to avoid octal.
60PORT=$(( 9005 + ($k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. 62if [ 9 -gt $k ]; then
63 NUM=$(printf '0%1s' $(( 10#$k + 1 )) )
64else
65 NUM=$(printf '%2s' $(( 10#$k + 1 )) )
66fi
67
68PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000.
61UUID=$(uuidgen) 69UUID=$(uuidgen)
62 70
63echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." 71echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME."
@@ -80,10 +88,9 @@ cp -P start-sim backup-sim
80cp -P start-sim stop-sim 88cp -P start-sim stop-sim
81 89
82sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini 90sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini
83sed -i "s@SIM_PORT@$PORT@g" ${sim}.xml 91sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini
84 92
85
86cp ../../current/scripts/opensim-monit.conf opensim-monit.conf
87sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf 93sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf
94
88sudo chown -R opensim:opensim .. 95sudo chown -R opensim:opensim ..
89sudo chmod -R g+w .. 96sudo chmod -R g+w ..