|
|
(2 intermediate revisions by one user not shown) |
Line 1: |
Line 1: |
− | Hopefully someone can use this.. works for me!
| + | Hi OpenSim enthusiasts! |
| | | |
− | based on: http://gentoo-wiki.com/TIP_Using_screen
| + | I think OpenSim rocks! I hope to contribute some helpful information to this Wiki. |
| | | |
− | I’m using MySql and a local grid setup. To use this script:
| + | Check out my site about OpenSim and other stuff at www.in2orbit.net |
| | | |
− | copy this text and paste it into a new file on your server with a .sh extension, ie ’sess.sh’
| + | -w |
− | | + | |
− | enter ‘./sess.sh’ at the command line once to start all the servers, it may take a minute to return to the command line
| + | |
− | | + | |
− | enter ‘./sess.sh’ again (or hit the up arrow key) to either attach to one of the servers or to close all servers
| + | |
− | | + | |
− | to attach to a server, enter its number or name
| + | |
− | | + | |
− | to close all servers hit any other key
| + | |
− | | + | |
− | <pre>
| + | |
− | #!/bin/bash
| + | |
− | | + | |
− | # filters the screen -ls output to show the sesssions
| + | |
− | sessions=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/((Attached)|(Detached))// p'`
| + | |
− | res=`echo "$sessions" | wc -w`
| + | |
− | | + | |
− | if [[ "$res" == "0" ]]
| + | |
− | then
| + | |
− | echo " No servers detected starting Grid..."
| + | |
− | | + | |
− | cd /usr/local/opensim2/bin
| + | |
− | sleep 5
| + | |
− | screen -S user -d -m mono OpenSim.Grid.UserServer.exe
| + | |
− | sleep 5
| + | |
− | screen -S grid -d -m mono OpenSim.Grid.GridServer.exe
| + | |
− | sleep 5
| + | |
− | screen -S asset -d -m mono OpenSim.Grid.AssetServer.exe
| + | |
− | sleep 5
| + | |
− | screen -S inv -d -m mono OpenSim.Grid.InventoryServer.exe
| + | |
− | sleep 5
| + | |
− | screen -S sim -d -m mono OpenSim.exe
| + | |
− | | + | |
− | exit
| + | |
− | fi
| + | |
− | | + | |
− | echo ''
| + | |
− | echo " CURRENT SESSIONS - enter session number to connect, any other key will stop servers"
| + | |
− | echo " ------------------------"
| + | |
− | #screen -ls | sed -ne 's/[[:space:]]//' -ne 's/((Attached)|(Detached))// p' | cat -n
| + | |
− | echo "$sessions" | cat -n
| + | |
− | echo " ------------------------"
| + | |
− | echo ''
| + | |
− | | + | |
− | #if first argument is not specified, script will ask for number of screen
| + | |
− | | + | |
− | if [ -z $1 ]
| + | |
− | then
| + | |
− | echo -n " Reattach to session: "
| + | |
− | read session
| + | |
− | else
| + | |
− | session=$1
| + | |
− | fi
| + | |
− | | + | |
− | #attach to specified session
| + | |
− | linenum=0
| + | |
− | name=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/((Attached)|(Detached))// p' |
| + | |
− | while read line
| + | |
− | do
| + | |
− | let "linenum += 1"
| + | |
− | if [[ "$linenum" -eq "$session" ]]
| + | |
− | then
| + | |
− | echo $line
| + | |
− | break
| + | |
− | fi
| + | |
− | done`
| + | |
− | | + | |
− | if [[ "$name" != "" ]]
| + | |
− | then
| + | |
− | screen -d -r "$name"
| + | |
− | else
| + | |
− | echo " Could not reattach to '$session' shutting down"
| + | |
− | | + | |
− | screen -S sim -r -m -X quit
| + | |
− | screen -S inv -r -m -X quit
| + | |
− | screen -S asset -r -m -X quit
| + | |
− | screen -S grid -r -m -X quit
| + | |
− | screen -S user -r -m -X quit
| + | |
− | | + | |
− | fi
| + | |
− | </pre>
| + | |
I think OpenSim rocks! I hope to contribute some helpful information to this Wiki.