Rex serverscript
From OpenSimulator
This article or section is archived information. The information in this page is no longer current, but it is being kept for historical reasons. Do not delete this information, since it may hold historical value. |
Purpose: The information on this page is out of date. However, it may still hold value to some people (examples are chat logs, version history, or OpenSimulator 0.6x specific info) or needs to be preserved for other reasons. It should be marked as archived information to prevent confusion.
Tag: {{archive}}
#!/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