Rex serverscript

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 +
__NOTOC__
 +
{{Template:Quicklinks}}
 +
<br />
 +
 
<source lang="bash">
 
<source lang="bash">
 
#!/bin/bash
 
#!/bin/bash

Revision as of 16:59, 21 May 2009


#!/bin/bash
function startrex {
pushd /opt/opensim > /dev/null 2>&1
pushd ./authentication/bin > /dev/null 2>&1
screen -S authentication -d -m mono Authentication.exe
popd > /dev/null 2>&1
pushd ./avatarstorage/bin > /dev/null 2>&1
screen -S avatarstorage -d -m mono AvatarStorage.exe
popd > /dev/null 2>&1
pushd ./simulator/bin > /dev/null 2>&1
screen -S simulator -d -m mono OpenSim.exe
popd > /dev/null 2>&1
}
 
function fixip {
wanip=`wget -qO- http://checkip.dyndns.org/ | sed 's|.* \([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\).*|\1|'`
lanip=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
iptables -t nat -A OUTPUT --dst $wanip -p tcp --dport 8000:9020 -j DNAT --to-destination $lanip
iptables -t nat -A OUTPUT --dst $wanip -p udp --dport 8000:9020 -j DNAT --to-destination $lanip
echo -e "Rewrote iptables for port 8000:9020 using $wanip(wan) and $lanip(lan)."
}
 
function killrex {
killall -15 screen > /dev/null 2>&1
screen -wipe > /dev/null 2>&1
echo "Rex killed..."
}
 
if [ "$#" -eq "0" ]; then
   session=( $(screen -ls | sed -r -ne 's/ *//g' -ne 's/\((At|De)tached\)// p') )
echo "valid parameters are: start stop fixip"
else
   case "$1" in
   "start")
   startrex
   ;;
   "stop")
   killrex
   ;;
   "fixip")
   fixip
   ;;
   esac
fi
Personal tools
General
About This Wiki