#wget http://www.python.org/ftp/python/2.3.4/Python-2.3.4.tgz
#tar zxvf Python-2.3.4.tgz
#cd Python-2.3.4
#./configure --prefix=/usr/local/python-2.3.4
#make &&make install
#mv /usr/bin/python /usr/bin/python-1.5
#ln –s /usr/local/python-2.3.4/bin/python /usr/bin/python

//
第一步:安装PYTHON



#wget http://voxel.dl.sourceforge.net/sourceforge/bittorrent/BitTorrent-3.4.2.tar.gz
#tar -vxzf BitTorrent-3.4.2.tar.gz
#cd BitTorrent-3.4.2.tar.gz //
安装BT的服务器端,不需要安装
#mkdir /var/log
#touch /var/log/bttrack.log //
生成日志文件

#./bttrack.py --port 6969 --dfile dstate >>/var/log/bttrack.log & //
时时生成日志文件

#./btmakemetafile.py /opt/CentOS-5.2-x86_64-bin-DVD.iso  http://192.168.2.2:6969/announce

//
/opt下生成BT文件
//
文件在 /opt/CentOS-5.2-x86_64-bin-DVD.iso.torrent


# nohup /opt/BitTorrent-3.4.2/btdownloadheadless.py --max_allow_in 20 --max_upload_rate 5000 --minport 6888 --maxport 6960 /opt/CentOS-5.2-x86_64-bin-DVD.iso.torrent --saveas /opt/CentOS-5.2-x86_64-bin-DVD.iso >/dev/null &

//
产生第一个种子


启动脚本BT的脚本startbt

#!/bin/bash

case $1 in

 

start)

nohup /opt/BitTorrent-3.4.2/bttrack.py --port 6969 --dfile dstate >>/opt/log/bttrack.log &

sleep 1

nohup /opt/BitTorrent-3.4.2/btdownloadheadless.py --max_allow_in 20 --max_upload_rate 5000 --minport 6888 --maxport 6960 /opt/CentOS-5.2-x86_64-bin-DVD.iso.torrent --saveas /opt/CentOS-5.2-x86_64-bin-DVD.iso >/dev/null &

echo "BT started"

;;

 

stop)

ps -efw | grep 'bttrack.py' | grep -v grep | awk '{print $2}' | xargs kill && killall python || \

echo "BT not stoped,Please kill it by hand"

;;

 

show)

ps -efw | grep python | grep -v grep

;;

 

*)

echo "Usage:./btseed.sh start|stop|show"

;;

 

esac