diff options
author | Riseon Kosten | 2012-02-06 02:39:32 +0000 |
---|---|---|
committer | Riseon Kosten | 2012-02-06 02:39:32 +0000 |
commit | 41d5e640ff3431fbe185661804857cd84ecff6e2 (patch) | |
tree | 38f360b99e73217470dc415193a9a798f086ec1a | |
parent | Fixed typo on the fix_var_run line (diff) | |
download | IGnoble-41d5e640ff3431fbe185661804857cd84ecff6e2.zip IGnoble-41d5e640ff3431fbe185661804857cd84ecff6e2.tar.gz IGnoble-41d5e640ff3431fbe185661804857cd84ecff6e2.tar.bz2 IGnoble-41d5e640ff3431fbe185661804857cd84ecff6e2.tar.xz |
renamed to match README and follow naming conventions as rest of install
-rwxr-xr-x | create_sim.sh | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/create_sim.sh b/create_sim.sh new file mode 100755 index 0000000..8f089fa --- /dev/null +++ b/create_sim.sh | |||
@@ -0,0 +1,110 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | NAME=$1 | ||
4 | LOCATION=$2 | ||
5 | URL=$3 | ||
6 | IP=$4 | ||
7 | |||
8 | OSPATH="/opt/opensim" | ||
9 | cd $OSPATH/config | ||
10 | |||
11 | k=0 | ||
12 | for i in $(seq 99) | ||
13 | do | ||
14 | j=$(printf "sim%02d" $i) | ||
15 | if [ -e "$j" ] | ||
16 | then | ||
17 | k=$i | ||
18 | fi | ||
19 | done | ||
20 | |||
21 | if [ "x$NAME" = "x" ] | ||
22 | then | ||
23 | NAME="No name sim $RANDOM" # Should be unique per grid. | ||
24 | echo "WARNING setting the sim name to [$NAME], this may not be what you want." | ||
25 | fi | ||
26 | |||
27 | if [ "x$LOCATION" = "x" ] | ||
28 | then | ||
29 | LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! | ||
30 | echo "WARNING setting the Location to $LOCATION, this may not be what you want." | ||
31 | fi | ||
32 | |||
33 | if [ "x$IP" = "x" ] | ||
34 | then | ||
35 | # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. | ||
36 | IP="0.0.0.0" | ||
37 | echo "WARNING setting the InternalAddress to $IP, this may not be what you want." | ||
38 | # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." | ||
39 | # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. | ||
40 | fi | ||
41 | |||
42 | # Here we make use of an external IP finding service. Careful, it may move. | ||
43 | if [ "x$URL" = "x" ] | ||
44 | then | ||
45 | 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. | ||
46 | echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." | ||
47 | fi | ||
48 | |||
49 | NUM=$(printf "%02d" $(($k + 1)) ) | ||
50 | PORT=$(( 9005 + ($k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. | ||
51 | UUID=$(uuidgen) | ||
52 | |||
53 | echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." | ||
54 | |||
55 | mkdir -p sim$NUM/Regions | ||
56 | cd sim$NUM | ||
57 | cat > Regions/sim.ini << zzzzEOFzzzz | ||
58 | [$NAME] | ||
59 | RegionUUID = $UUID | ||
60 | Location = $LOCATION | ||
61 | InternalAddress = $IP | ||
62 | InternalPort = $(( $PORT + 1 )) | ||
63 | AllowAlternatePorts = False | ||
64 | ExternalHostName = $URL | ||
65 | zzzzEOFzzzz | ||
66 | |||
67 | ln -s ../../setup/start-sim start-sim | ||
68 | cp start-sim stop-sim | ||
69 | cp start-sim backup-sim | ||
70 | cp start-sim sim-console | ||
71 | cp ../../current/bin/OpenSim.exe.config OpenSim.exe.config | ||
72 | sed -i 's@<appender name="LogFileAppender" type="log4net.Appender.FileAppender">@<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">@' OpenSim.exe.config | ||
73 | sed -i "s@<file value=\"OpenSim.log\" />@<file value=\"/var/log/opensim/sim$NUM.log\" />@" OpenSim.exe.config | ||
74 | |||
75 | cat > ThisSim.ini << zzzzEOFzzzz | ||
76 | [Startup] | ||
77 | PIDFile = "/var/run/opensim/sim$NUM.pid" | ||
78 | regionload_regionsdir="$OSPATH/config/sim$NUM/Regions" | ||
79 | DecodedSculptMapPath = "caches/sim$NUM/j2kDecodeCache" | ||
80 | |||
81 | [Network] | ||
82 | console_port = $(( $PORT + 2 )) | ||
83 | http_listener_port = $(( $PORT + 0)) | ||
84 | |||
85 | [AssetCache] | ||
86 | ;; Damn, this gets overidden later by the FlotsamCache.ini file. | ||
87 | ;; At least it says it can be shared by multiple instances. | ||
88 | ; CacheDirectory = "caches/sim$NUM/assetcache" | ||
89 | |||
90 | [XEngine] | ||
91 | ScriptEnginesPath = "caches/sim$NUM/ScriptEngines" | ||
92 | |||
93 | [GridService] | ||
94 | MapTileDirectory = "caches/sim$NUM/maptiles" | ||
95 | |||
96 | [DataSnapshot] | ||
97 | snapshot_cache_directory = "caches/sim$NUM/DataSnapshot" | ||
98 | |||
99 | [Includes] | ||
100 | Include-Common = config/common.ini | ||
101 | |||
102 | zzzzEOFzzzz | ||
103 | cp ../OpenSim.ConsoleClient.ini OpenSim.ConsoleClient.ini | ||
104 | sed -i "s@; port = 9002@port = $(( $PORT + 2 ))@" OpenSim.ConsoleClient.ini | ||
105 | |||
106 | cp ../../setup/opensim-monit.conf opensim-monit.conf | ||
107 | sed -i "s@sim01@sim$NUM@g" opensim-monit.conf | ||
108 | sudo chown -R opensim:opensim .. | ||
109 | sudo chmod -R g+w .. | ||
110 | |||