Summary: | Start scripts for bittorrent-tracker | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Markus Tacker <m> |
Component: | New packages | Assignee: | Gentoo net-p2p team <net-p2p> |
Status: | RESOLVED INVALID | ||
Severity: | enhancement | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Markus Tacker
2005-10-21 05:43:10 UTC
# cat /etc/init.d/bittorrent-tracker
#!/sbin/runscript
opts="start stop restart"
depend() {
need net
}
start() {
result=0
ebegin "Starting bittorrent tracker"
if [ ! -d ${BASEDIR}/${SUBDIR} ]
then
einfo "Directory ${BASEDIR}/${SUBDIR} not existing, trying to
create..."
if [ ! -d ${BASEDIR} ]
then
mkdir -p ${BASEDIR}
chown ${USER}:users ${BASEDIR}
if [ ! -d ${BASEDIR} ]
then
eerror "Directory ${BASEDIR} could not be created!"
result=$(( ${result} + 1 ))
fi
fi
su ${USER} -c "mkdir ${BASEDIR}/${SUBDIR}"
if [ ! -d ${BASEDIR}/${SUBDIR} ]
then
eerror "Directory ${BASEDIR}/${SUBDIR} could not be
created!"
result=$(( ${result} + 1 ))
fi
einfo "...ok!"
fi
cd ${BASEDIR}/${SUBDIR}/
env HOME=${BASEDIR} start-stop-daemon --quiet --start -c ${USER} \
-p /var/run/bittorrent-tracker.pid -m \
--nicelevel ${NICE} -x /usr/bin/bittorrent-tracker -- --port
${PORT} --dfile ${BASEDIR}/${SUBDIR}/dfile --logfile ${LOG} &>${LOG} &
sleep 5
if ! pgrep -u ${USER} -f "/usr/bin/python /usr/bin/bittorrent-tracker"
>/dev/null
then
eerror "bittorrent-tracker could not be started! Check logfile:
${LOG}"
result=$(( ${result} + 1 ))
fi
eend $result
}
stop() {
start-stop-daemon --stop -p /var/run/bittorrent-tracker.pid &>/dev/null
local ret=$?
eend ${ret} "Failed to stop bittorrent-tracker"
rm -f /var/run/bittorrent-tracker.pid
return ${ret}
eend $?
}
restart() {
svc_stop
sleep 5
svc_start
}
# cat /etc/init.d/bittorrent-tracker
#!/sbin/runscript
opts="start stop restart"
depend() {
need net
}
start() {
result=0
ebegin "Starting bittorrent tracker"
if [ ! -d ${BASEDIR}/${SUBDIR} ]
then
einfo "Directory ${BASEDIR}/${SUBDIR} not existing, trying to
create..."
if [ ! -d ${BASEDIR} ]
then
mkdir -p ${BASEDIR}
chown ${USER}:users ${BASEDIR}
if [ ! -d ${BASEDIR} ]
then
eerror "Directory ${BASEDIR} could not be created!"
result=$(( ${result} + 1 ))
fi
fi
su ${USER} -c "mkdir ${BASEDIR}/${SUBDIR}"
if [ ! -d ${BASEDIR}/${SUBDIR} ]
then
eerror "Directory ${BASEDIR}/${SUBDIR} could not be
created!"
result=$(( ${result} + 1 ))
fi
einfo "...ok!"
fi
cd ${BASEDIR}/${SUBDIR}/
env HOME=${BASEDIR} start-stop-daemon --quiet --start -c ${USER} \
-p /var/run/bittorrent-tracker.pid -m \
--nicelevel ${NICE} -x /usr/bin/bittorrent-tracker -- --port
${PORT} --dfile ${BASEDIR}/${SUBDIR}/dfile --logfile ${LOG} &>${LOG} &
sleep 5
if ! pgrep -u ${USER} -f "/usr/bin/python /usr/bin/bittorrent-tracker"
>/dev/null
then
eerror "bittorrent-tracker could not be started! Check logfile:
${LOG}"
result=$(( ${result} + 1 ))
fi
eend $result
}
stop() {
start-stop-daemon --stop -p /var/run/bittorrent-tracker.pid &>/dev/null
local ret=$?
eend ${ret} "Failed to stop bittorrent-tracker"
rm -f /var/run/bittorrent-tracker.pid
return ${ret}
eend $?
}
restart() {
svc_stop
sleep 5
svc_start
}
we already have start script for bittorrent tracker. it's called bttrack |