PID file on Debian

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
jlazkano
Posts: 13
Joined: Sun Jul 12, 2009 9:05 pm

PID file on Debian

Post by jlazkano »

Hello forum, I have a server with Transmission and I want to get the PID file of the process, I check the init script and there is a comment about he PID file:

Code: Select all

# cat /etc/init.d/transmission-daemon
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          transmission-daemon
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start or stop the transmission-daemon.
### END INIT INFO

NAME=transmission-daemon
DAEMON=/usr/bin/$NAME
USER=debian-transmission
# FIXME: no pidfile support; forks, so --make-pidfile doesn't work either
#PIDFILE=/var/run/$NAME.pid
STOP_TIMEOUT=3

export PATH="${PATH:+$PATH:}/sbin"

[ -x $DAEMON ] || exit 0

[ -e /etc/default/$NAME ] && . /etc/default/$NAME

. /lib/lsb/init-functions

start_daemon () {
    if [ $ENABLE_DAEMON != 1 ]; then
        log_progress_msg "(disabled, see /etc/default/${NAME})"
    else
        start-stop-daemon --start \
        --chuid $USER \
        --exec $DAEMON -- $OPTIONS
    fi
}

case "$1" in
    start)
        log_daemon_msg "Starting bittorrent daemon" "$NAME"
        start_daemon
        log_end_msg 0
        ;;
    stop)
        log_daemon_msg "Stopping bittorrent daemon" "$NAME"
        start-stop-daemon --stop --quiet \
            --exec $DAEMON --retry $STOP_TIMEOUT \
            --oknodo
        log_end_msg 0
        ;;
    reload)
        log_daemon_msg "Reloading bittorrent daemon" "$NAME"
        start-stop-daemon --stop --quiet \
            --exec $DAEMON \
            --oknodo --signal 1
        log_end_msg 0
        ;;
    restart|force-reload)
        log_daemon_msg "Restarting bittorrent daemon" "$NAME"
        start-stop-daemon --stop --quiet \
            --exec $DAEMON --retry $STOP_TIMEOUT \
            --oknodo
        start_daemon
        log_end_msg 0
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}"
        exit 2
        ;;
esac

exit 0
Is it possible to add the PID file option?

Thanks and best regards.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: PID file on Debian

Post by Jordan »

I don't understand the question. Are you asking if it's possible to specify a pidfile in the init script? Are you asking for help doing that, or asking for it to be included automatically in a future version?
jlazkano
Posts: 13
Joined: Sun Jul 12, 2009 9:05 pm

Re: PID file on Debian

Post by jlazkano »

Hello, I am asking if it's possible to specify a pidfile in the init script. Sorry for my english.

I want to check the service with monit.

Thanks and best regards.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: PID file on Debian

Post by Jordan »

Yes, you should be able to modify the init script to add -x / --pid-file to specify a pidfile when the init script starts up transmission-daemon as a service.

The init scripts are written "downstream" from Transmission on a per-distro basis, so the Transmission developers don't have any direct control over what goes in them.
Post Reply