2

After moving to new baselayout2 in gentoo I always have

 rtorrentd                               [  crashed  ]

even though it runs in screen with no issues.

Here are the conf.d:

# Owner of screen session and rtorrent process
USER="zerkms"

# Home dir with .rtorrent.rc
HOME_DIR="/home/zerkms"

# Screen options for starting rtorrent
SCREEN_OPTS="-dmS rtorrent /usr/bin/rtorrent"

# Path to *.pid file
PIDFILE="/var/run/screen.pid"

# Path to 'screen' binary
SCREEN_BIN="/usr/bin/screen"

# Path to 'rtorrent' binary
RTORRENT_BIN="/usr/bin/rtorrent"

and init.d accordingly:

depend() {
        need net
}

start() {
        ebegin "Starting screen & rtorrent"
        env HOME=${HOME_DIR} start-stop-daemon --start --background --make-pidfile --pidfile ${PIDFILE} \
        --chuid ${USER} --exec ${SCREEN_BIN} -- ${SCREEN_OPTS}
        eend $?
}

stop() {
        ebegin "Stopping screen & rtorrent"
        start-stop-daemon --stop --quiet --exec ${RTORRENT_BIN}
        eend $?
}

restart() {
        ebegin "Restarting screen & rtorrent"
        svc_stop
        sleep 2
        svc_start
        eend $?
}

Tried to compare with any valid init.d script but haven't found any significant differences. Any ideas why that [crached] label appears?

zerkms
  • 431
  • 2
  • 5
  • 17
  • Do you want to know what outputs the text, or what would tell it that the daemon has crashed? – Ignacio Vazquez-Abrams May 09 '11 at 14:41
  • @Ignacio Vazquez-Abrams: I would like to know why it thinks that daemon has crashed (because actually it is not) and want to fix it to be `[started]` like other daemons – zerkms May 09 '11 at 14:44

1 Answers1

2

The normal way to detect that a daemon has crashed is presence of a PID file, but absence of a daemon process with that PID. The daemon removes the PID file during normal shutdown, but leaves it after a crash.

If you believe that the detection is faulty then you should shut down the daemon, erase the PID file, then restart the daemon.

Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84