diff options
Diffstat (limited to '')
-rwxr-xr-x | create_region.sh | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/create_region.sh b/create_region.sh index f13eaef..d4c42a8 100755 --- a/create_region.sh +++ b/create_region.sh | |||
@@ -4,7 +4,6 @@ NAME=$1 | |||
4 | LOCATION=$2 | 4 | LOCATION=$2 |
5 | URL=$3 | 5 | URL=$3 |
6 | IP=$4 | 6 | IP=$4 |
7 | |||
8 | cd /opt/opensim/config | 7 | cd /opt/opensim/config |
9 | 8 | ||
10 | k=0 | 9 | k=0 |
@@ -20,21 +19,27 @@ done | |||
20 | if [ "x$NAME" = "x" ] | 19 | if [ "x$NAME" = "x" ] |
21 | then | 20 | then |
22 | NAME="No name sim $RANDOM" # Should be unique per grid. | 21 | NAME="No name sim $RANDOM" # Should be unique per grid. |
22 | echo "WARNING setting the sim name to [$NAME], this may not be what you want." | ||
23 | fi | 23 | fi |
24 | 24 | ||
25 | if [ "x$LOCATION" = "x" ] | 25 | if [ "x$LOCATION" = "x" ] |
26 | then | 26 | then |
27 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! | 27 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! |
28 | echo "WARNING setting the Location to $LOCATION, this may not be what you want." | ||
28 | fi | 29 | fi |
29 | 30 | ||
30 | if [ "x$URL" = "x" ] | 31 | if [ "x$URL" = "x" ] |
31 | then | 32 | then |
32 | URL=$(hostname) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. | 33 | URL=$(hostname) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. |
34 | echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." | ||
33 | fi | 35 | fi |
34 | 36 | ||
35 | if [ "x$IP" = "x" ] | 37 | if [ "x$IP" = "x" ] |
36 | then | 38 | then |
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. | 39 | # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. |
40 | IP=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) | ||
41 | echo "WARNING setting the InternalAddress to $IP, this may not be what you want." | ||
42 | echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." | ||
38 | fi | 43 | fi |
39 | 44 | ||
40 | NUM=$(printf "%02d" $(($k + 1)) ) | 45 | NUM=$(printf "%02d" $(($k + 1)) ) |
@@ -49,23 +54,16 @@ cat > Regions/sim.ini << zzzzEOFzzzz | |||
49 | [$NAME] | 54 | [$NAME] |
50 | RegionUUID = $UUID | 55 | RegionUUID = $UUID |
51 | Location = $LOCATION | 56 | Location = $LOCATION |
52 | InternalAddress = 0.0.0.0 | 57 | InternalAddress = $IP |
53 | InternalPort = $(( $PORT + 1 )) | 58 | InternalPort = $(( $PORT + 1 )) |
54 | AllowAlternatePorts = False | 59 | AllowAlternatePorts = False |
55 | ExternalHostName = $URL | 60 | ExternalHostName = $URL |
56 | zzzzEOFzzzz | 61 | zzzzEOFzzzz |
57 | 62 | ||
58 | ln -s ../../setup/start-sim-in-rest start-sim-in-rest | 63 | ln -s ../../setup/start-sim-in-rest start-sim-in-rest |
59 | #ln -s ../../current current | ||
60 | cp ../../current/bin/OpenSim.exe.config OpenSim.exe.config | 64 | cp ../../current/bin/OpenSim.exe.config OpenSim.exe.config |
61 | sed -i "s@<file value=\"OpenSim.log\" />@<file value=\"/var/log/opensim/sim$NUM.log\" />@" OpenSim.exe.config | 65 | sed -i "s@<file value=\"OpenSim.log\" />@<file value=\"/var/log/opensim/sim$NUM.log\" />@" OpenSim.exe.config |
62 | 66 | ||
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 | |||
69 | cat > ThisSim.ini << zzzzEOFzzzz | 67 | cat > ThisSim.ini << zzzzEOFzzzz |
70 | [Startup] | 68 | [Startup] |
71 | PIDFile = "/var/run/opensim/sim$NUM.pid" | 69 | PIDFile = "/var/run/opensim/sim$NUM.pid" |
@@ -81,4 +79,5 @@ sed -i "s@; port = 9002@port = $(( $PORT + 2 ))@" OpenSim.ConsoleClient.ini | |||
81 | 79 | ||
82 | cp ../../setup/opensim-monit.conf opensim-monit.conf | 80 | cp ../../setup/opensim-monit.conf opensim-monit.conf |
83 | sed -i "s@sim01@sim$NUM@g" opensim-monit.conf | 81 | sed -i "s@sim01@sim$NUM@g" opensim-monit.conf |
82 | sudo chown -R opensim:opensim .. | ||
84 | 83 | ||