Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110023 - Start scripts for bittorrent-tracker
Summary: Start scripts for bittorrent-tracker
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo net-p2p team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-21 05:43 UTC by Markus Tacker
Modified: 2005-10-30 05:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Tacker 2005-10-21 05:43:10 UTC
I've created start scripts for bittorrent tracker.
I think they may be of use.
Comment 1 Markus Tacker 2005-10-21 05:44:44 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
}
Comment 2 Markus Tacker 2005-10-21 05:45:07 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
}
Comment 3 Marcin Kryczek (RETIRED) gentoo-dev 2005-10-30 05:03:35 UTC
we already have start script for bittorrent tracker. it's called bttrack