ãããã®VPSã§OpenSimãåããåæè¨å®-2
åã¨ã³ã㪠http://d.hatena.ne.jp/takeshich/20120307/1331136918 ã§ã¯ãOSgridã«æ¥ç¶ããã¨ããã¾ã§è¨è¿°ãã¾ããã
æ¬ã¨ã³ããªã§ã¯èªåèµ·åã®ã¹ã¯ãªããã«ã¤ãã¦è¨è¿°ãããã¨æãã¾ãã
å 容
- èªåèµ·åã¹ã¯ãªããã®ä½æ
- screenã®ã¤ã³ã¹ãã¼ã«
- ã¹ã¯ãªãã
- ã¹ã¯ãªããã®é©ç¨
- screenã®TIPS
- ããã£ãã¨ãã
èªåèµ·åã¹ã¯ãªããã®ä½æ
ãµã¼ããåèµ·åããéã«èªåçã«å®è¡ãã¦ãããããã«ã¹ã¯ãªãããä½æãã¾ãã
ã¾ãã
/etc/init.d/osgrid start
ã§ãèµ·åãã
/etc/init.d/osgrid stop
ã§åæ¢ããããã«ãã¾ãã
screenã®ã¤ã³ã¹ãã¼ã«
調ã¹ãã¨ãããããã¯ã°ã©ã¦ã³ãã§åããããã«OpenSimã§ã¯screenã使ç¨ããããã§ãã
OpenSimã対話çãªããã³ããã«ãªãã®ã§ãæ示çã«ã»ãã·ã§ã³ãè²¼ã£ã¦ãè£ã«åããã¾ããããã§ãã
[root@foo ~]# yum install screen
OpenSim.exeããããã£ã¬ã¯ããªã«ç§»åãã¦ã
screenã³ãã³ãã使ã£ã¦ãOpenSimãå®è¡ãã¾ãã
[takeshich@foo bin]$ cd osgrid/bin/ [takeshich@foo bin]$ screen -S osgrid -d -m /opt/novell/mono/bin/mono ./OpenSim.exe
OpenSimãåæ¢ããå ´åã¯
[takeshich@foo bin]$ screen -S osgrid -p 0 -X stuff 'quit\n'
ã»ãã·ã§ã³åãæå®ãã¦ããã¾ããterminalã«ã¯è¡¨ç¤ºããã¾ããããOpenSimã¯è½ã¡ã¾ãã
ã¹ã¯ãªãã
ãããã試è¡é¯èª¤ãã¦ãã¹ã¯ãªããä½ã£ã¦ã¿ã¾ãããã¾ããã¡ããä½ã£ãããã§ã¯ãªãã¦ã
http://www.nsl.tuis.ac.jp/svn/opensim/opensim.nsl.tools/trunk/config/opensim_region
ã®ã¹ã¯ãªãããå¤æ´ãã¾ãããã©ã¤ã»ã³ã¹ã«ã¤ãã¦è¨è¿°ããªãã£ãã®ã§ãããåé¡ããã£ããæãã¦ãã ããã*1
#!/bin/bash # # osgird # # chkconfig: 2345 80 30 # description: osgrid start/stop script # Source function library. . /etc/rc.d/init.d/functions OSGRID=osgrid OSDIR=/home/takeshich/$OSGRID/bin # OpenSimãã¤ã³ã¹ãã¼ã«ãããã£ã¬ã¯ããªãæå® PRGFL=/etc/init.d/$OSGRID # ãã®ã¹ã¯ãªããã®ãã«ãã¹ MONO=/opt/novell/mono/bin/mono # monoã¸ã®ãã¹ SLEEPTM=90 # ãªã¹ã¿ã¼ãæã®ã¹ãªã¼ãæé CHKTM=30 # ç£è¦éé export MONO_THREADS_PER_CPU=512 ulimit -s 262144 SCRNID=$OSGRID PIDFL=/var/run/opensim_region_shell$OSGRID.pid USER=takeshich EXEFILE=/tmp/tmp$OSGRID.sh start() { echo \#\!/bin/bash > $EXEFILE echo export MONO_THREADS_PER_CPU=512 >> $EXEFILE echo ulimit -s 262144 >> $EXEFILE echo cd $OSDIR >> $EXEFILE echo screen -S $OSGRID -d -m $MONO $OSDIR/OpenSim.exe >> $EXEFILE chmod +x $EXEFILE #EXEFILE="" #EXEFILE=$OSDIR/bin/osgrid1_exec.sh su $USER -c $EXEFILE echo "OpenSim Region Server Start." sleep 5 #make pid-file #ps afxu | grep mono |grep -w $OSGRID | awk {'print $2'} > $PIDFL #rm -f $EXEFILE } stop() { su $USER -c "screen -S $SCRNID -p 0 -X stuff $'quit\n' 1> /dev/null 2>&1" echo "OpenSim Region Server Stoped." } kill_loop() { PID=`cat $PIDFL 2> /dev/null` if [ "$PID" != "" ]; then kill -9 $PID 2> /dev/null rm -f $PIDFL fi } loop_check() { kill_loop echo $$ >| $PIDFL while [ "" = "" ]; do sleep $CHKTM CHECK=`ps ax|grep SCREEN |grep $SCRNID` if [ "$CHECK" = "" ]; then start fi done } case "$1" in start) start #/bin/bash $PRGFL check & ;; stop) kill_loop stop ;; restart|reload) kill_loop stop sleep $SLEEPTM start #/bin/bash $PRGFL check & ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?
ä¸è¬ã¦ã¼ã¶ã¯ãtakeshichã§ãå®è¡ããããã£ã¬ã¯ããªã®ååãã»ãã·ã§ã³åãªã©ã«ä½¿ãåãã¦ãã¾ãã
使ç¨ãããéã¯é©å®å¤æ´ãã¦ãã ããã
OSGRID=osgrid USER=takeshich
試ããç°å¢ã¨ãã¦ã¯ãä¸è¬ã¦ã¼ã¶takeshichã§ãã°ã¤ã³ãã¦ããã¼ã ã
[takeshich@foo ~]$ pwd /home/takeshich
ããã§ã
[takeshich@foo ~]$ mkdir osgrid [takeshich@foo ~]$ cd osgrid [takeshich@foo osgrid]$ wget osgridã®å®è¡ãã¡ã¤ã« [takeshich@foo osgrid]$ unzip osgridã®å®è¡ãã¡ã¤ã« [takeshich@foo osgrid]$ cd bin [takeshich@foo osgrid]$ pwd /home/takeshich/osgrid/bin
ã§OpenSim.exeãåå¨ããã®ãç°å¢ã§ãã
ã¹ã¯ãªããã®é©ç¨
[root@foo ~]# cd /etc/init.d/ [root@foo ~]# vi osgrid
ã¹ã¯ãªãããã³ã¼ãã¼ã¢ã³ããã¼ã¹ããã¦ãä¿åãã¦ã
[root@foo ~]# chmod 755 ./osgrid [root@foo ~]# chkconfig osgrid on
ç»é²ãããã確èªãã¾ãã
[root@foo ~]# chkconfig --list |grep osgrid
ã¹ã¯ãªããã«ãã稼å確èª
[root@foo ~]# /etc/init.d/osgrid start
ã§ç¨¼åããããã¨ã
[root@foo ~]# ps aux
ä¸è¬ã¦ã¼ã¶ã§OpenSimãåãã¦ãããã¨ã確èªãã¾ãã
ã¾ãã
/home/takeshich/osgrid/bin以ä¸ã«
OpenSim.logãããã®ã§ã
[takeshich@foo bin]$ tail -f ./OpenSim.log
ã¨ãããã°ãæµãããã¨ã確èªããã®ãããã§ããæããã®ã¯ãCtrl+cã§ãã
screenã®TIPS
screenã使ç¨ãã¦OpenSim.exeãèµ·åãã¦ããã®ã§ãã¹ã¯ãªããã§èµ·åãã¦ããããã»ã¹ã«ã¢ã¿ãããããã¨ãã§ãã¾ãã
[takeshich@foo ~]$ screen -ls
ã¨ããã¨screenã®ããã»ã¹ã表示ãããã®ã§
[takeshich@foo ~]$ screen -r ããã»ã¹çªå·
ã¨ãã¦ãããã¨ãã¢ã¿ããã§ããOpenSimã®ãµã¼ãã³ãã³ããªã©ã®å ¥åºåãè¡ãã¾ãã
ã¾ãããã¿ãã(screenã®ããã»ã¹ããé¢ãããããã»ã¹èªä½ã¯æ»ãªãªã)ããã«ã¯ã
Ctrl+Dãå ¥åããç¶ãã¦aãå ¥åãã¾ãã
ããã£ãã¨ãã
ã¹ã¯ãªãããä½æãã¦ãã¦ãrootã§OpenSimã稼åããã¦ãã¾ã£ã¦ããã®ãã¨ä¸è¬ã¦ã¼ã¶ã§åããªãã¨ãããã¨ãèµ·ãã¾ãããããã¯ãrootã§å®è¡ããã¨ä¸é¨ã®ãã¡ã¤ã«ã®æ¨©éãrootã®æ¨©éã«ãªã£ã¦ãã¾ã£ã¦ãä¸è¬ã¦ã¼ã¶ã§ã¯æ¨©éããªãã¦ä½¿ããªãã¨ããç¶æ³ã§ããã
次ã¨ã³ããªã§ã¯iptablesã«ã¤ãã¦è¨è¿°ããäºå®ã§ãã