Permalink
Browse files

mvoing config around.

adding a script to start up many lt servers on the same host (for testing)
  • Loading branch information...
1 parent 63d7b60 commit d9f0605718d849b1d6d5d712662a847e3576377a BuzzTroll committed Sep 1, 2010
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+count=$1
+if [ "X$1" == "X" ]; then
+ count=1
+fi
+
+dir=`dirname $0`
+cd $dir/..
+pypath=`pwd`
+if [ "X${PYTHONPATH}" == "X" ]; then
+ export PYTHONPATH=$pypath
+else
+ export PYTHONPATH=$pypath:${PYTHONPATH}
+fi
+# so that we pick up the ini file
+export LANTORRENT_HOME=$pypath
+
+
+rm -f $LANTORRENT_HOME/tests/xinetd.d/*
+for i in `seq 1 $count`
+do
+
+ PORT=$RANDOM
+ while [ $PORT -lt 2048 ];
+ do
+ $PORT=$RANDOM
+ x=`netstat -l --tcp --numeric-ports | grep $PORT`
+ if [ "X$x" != "X" ]; then
+ $PORT=0
+ fi
+ done
+
+ SERVNAME="lantorrent$PORT"
+
+ echo "s/@PORT@/$PORT/"
+ echo "s/@SERVICENAME@/$SERVNAME/"
+ echo "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^"
+ sed -e "s/@PORT@/$PORT/" -e "s/@SERVICENAME@/$SERVNAME/" -e "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^" $LANTORRENT_HOME/etc/lantorrent.inet.in | tee $LANTORRENT_HOME/tests/xinetd.d/$SERVNAME
+
+done
+
+ls -l $LANTORRENT_HOME/tests/xinetd.d/
+echo "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^"
+sed "s^@LANTORRENT_HOME@^$LANTORRENT_HOME^" $LANTORRENT_HOME/etc/xinetd.conf.in | tee $LANTORRENT_HOME/tests/xinetd.conf
+
+
+exec xinetd -d -f $LANTORRENT_HOME/tests/xinetd.conf -dontfork
@@ -4,13 +4,14 @@
# to the originating source the time in seconds since midnight on January first
# 1900.
# This is the tcp version.
-service lantorrent
+service @SERVICENAME@
{
+ type = UNLISTED
disable = no
socket_type = stream
protocol = tcp
user = bresnaha
wait = no
- port = 9765
- server = /home/bresnaha/Dev/Nimbus/nimbus/lantorrent/bin/lt.sh
+ port = @PORT@
+ server = @LANTORRENT_HOME@/bin/lt.sh
}
@@ -0,0 +1,14 @@
+# Simple configuration file for xinetd
+#
+# Some defaults, and include /etc/xinetd.d/
+
+defaults
+{
+
+# Please note that you need a log_type line to be able to use log_on_success
+# and log_on_failure. The default is the following :
+# log_type = SYSLOG daemon info
+
+}
+
+includedir @LANTORRENT_HOME@/tests/xinetd.d

0 comments on commit d9f0605

Please sign in to comment.