aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/create_region.sh
diff options
context:
space:
mode:
Diffstat (limited to 'create_region.sh')
-rwxr-xr-xcreate_region.sh84
1 files changed, 84 insertions, 0 deletions
diff --git a/create_region.sh b/create_region.sh
new file mode 100755
index 0000000..f13eaef
--- /dev/null
+++ b/create_region.sh
@@ -0,0 +1,84 @@
1#!/bin/bash
2
3NAME=$1
4LOCATION=$2
5URL=$3
6IP=$4
7
8cd /opt/opensim/config
9
10k=0
11for i in $(seq 99)
12do
13 j=$(printf "sim%02d" $i)
14 if [ -e "$j" ]
15 then
16 k=$i
17 fi
18done
19
20if [ "x$NAME" = "x" ]
21then
22 NAME="No name sim $RANDOM" # Should be unique per grid.
23fi
24
25if [ "x$LOCATION" = "x" ]
26then
27 LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case!
28fi
29
30if [ "x$URL" = "x" ]
31then
32 URL=$(hostname) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too.
33fi
34
35if [ "x$IP" = "x" ]
36then
37 IP="0.0.0.0" # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP.
38fi
39
40NUM=$(printf "%02d" $(($k + 1)) )
41PORT=$(( 9005 + ($k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000.
42UUID=$(uuidgen)
43
44echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME."
45
46mkdir -p sim$NUM/Regions
47cd sim$NUM
48cat > Regions/sim.ini << zzzzEOFzzzz
49[$NAME]
50RegionUUID = $UUID
51Location = $LOCATION
52InternalAddress = 0.0.0.0
53InternalPort = $(( $PORT + 1 ))
54AllowAlternatePorts = False
55ExternalHostName = $URL
56zzzzEOFzzzz
57
58ln -s ../../setup/start-sim-in-rest start-sim-in-rest
59#ln -s ../../current current
60cp ../../current/bin/OpenSim.exe.config OpenSim.exe.config
61sed -i "s@<file value=\"OpenSim.log\" />@<file value=\"/var/log/opensim/sim$NUM.log\" />@" OpenSim.exe.config
62
63#cp current/bin/OpenSim.ini OpenSim.ini
64#sed -i "s@regionload_regionsdir=\"/opt/opensim/config\"@regionload_regionsdir=\"/opt/opensim/config/sim$NUM/Regions\"@" OpenSim.ini
65#sed -i "s@; PIDFile = \"/var/run/opensim/opensim.pid\"@PIDFile = \"/var/run/opensim/sim$NUM.pid\"@" OpenSim.ini
66#sed -i "s@;http_listener_port = 9000@http_listener_port = $(( $PORT + 0))@" OpenSim.ini
67#sed -i "s@; console_port = 0@console_port = $(( $PORT + 2 ))@" OpenSim.ini
68
69cat > ThisSim.ini << zzzzEOFzzzz
70[Startup]
71 PIDFile = "/var/run/opensim/sim$NUM.pid"
72 regionload_regionsdir="/opt/opensim/config/sim$NUM/Regions"
73
74[Network]
75 console_port = $(( $PORT + 2 ))
76 http_listener_port = $(( $PORT + 0))
77zzzzEOFzzzz
78
79cp ../../current/bin/OpenSim.ConsoleClient.ini OpenSim.ConsoleClient.ini
80sed -i "s@; port = 9002@port = $(( $PORT + 2 ))@" OpenSim.ConsoleClient.ini
81
82cp ../../setup/opensim-monit.conf opensim-monit.conf
83sed -i "s@sim01@sim$NUM@g" opensim-monit.conf
84