blob: 319c526d2e5f5e607866c299bd3472ab76b942f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#!/bin/bash
#
# chkconfig: - 16 84
# description: Start up tracker for BitTorrent
#
# processname: bttrack
# config: /etc/sysconfig/bittorrent
# source function library
. /etc/rc.d/init.d/functions
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
# defaults
TRACKPORT=6969
TRACKSTATEFILE=/var/lib/bittorrent/state/bttrack
TRACKOPTS=
TRACKLOG=/var/log/bittorrent/bttrack.log
# directory of torrents that the tracker is allowed to serve
TRACKDIR="/var/lib/bittorrent/data"
# source the config
. /etc/sysconfig/bittorrent
RETVAL=0
prog="/usr/bin/bttrack"
btuser="torrent"
btgroup="torrent"
case "$1" in
start)
echo -n $"Starting BitTorrent tracker: "
: > /var/run/bittorrent-tracker.pid
/bin/chown $btuser:$btgroup /var/run/bittorrent-tracker.pid
/sbin/runuser -s /bin/sh -c "$prog --port $TRACKPORT \
--dfile $TRACKSTATEFILE --logfile $TRACKLOG $TRACKOPTS \
--allowed_dir $TRACKDIR" $btuser &> /dev/null &
disown -ar
usleep 500000
status bttrack &> /dev/null && echo_success || echo_failure
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bttrack
echo
;;
stop)
echo -n $"Shutting down BitTorrent tracker: "
killproc $prog
#killproc "/usr/bin/python $prog"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bttrack
echo
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/bttrack ]; then
$0 stop
$0 start
fi
RETVAL=$?
;;
status)
status bttrack
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
exit 1
esac
exit $RETVAL
|