[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

start-stop-daemon and multiple exim daemons



Hi!

I am running exim as two daemons. One is listening on port 25, the
other does periodic queue runs only when I am online. The queue runner
exim is killed off when I go offline.

This is my start script:

|=>ROOT<=@torres:/mnt/maindisk/home/mh # cat /etc/init.d/exim
|
|PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|DAEMON=/usr/local/bin/exim
|NAME=exim
|PORT="25"
|PARM="bd" # -oX $PORT is added on command line
|DESC="exim on port $PORT"
|DESC_QUEUE="exim queue-runner"
|PARM_QUEUE="q2m"
|
|test -f $DAEMON || exit 0
|
|set -e
|
|case "$1" in
|  start)
|        echo -n "Starting $DESC: "
|        start-stop-daemon --start --quiet \
|                --pidfile /var/run/$NAME.$PORT.pid-$PARM \
|                --exec $DAEMON -- -$PARM -oX $PORT
|        echo "$DESC."
|        ;;
|  stop)
|        echo -n "Stopping $DESC: "
|        start-stop-daemon --stop --quiet \
|                --pidfile /var/run/$NAME.$PORT.pid-$PARM
|        echo "$DESC."
|        start-stop-daemon --stop --quiet \
|                --pidfile /var/run/$NAME.pid-$PARM_QUEUE
|        echo "$DESC_QUEUE."
|        ;;
|  queue-start)
|        echo -n "Starting $DESC_QUEUE: "
|        start-stop-daemon --start --quiet \
|                --pidfile /var/run/$NAME.pid-$PARM_QUEUE \
|                --exec $DAEMON -- -$PARM_QUEUE
|        echo "$DESC_QUEUE."
|        ;;
|  queue-stop)
|        echo -n "Stopping $DESC_QUEUE: "
|        start-stop-daemon --stop --quiet \
|                --pidfile /var/run/$NAME.pid-$PARM_QUEUE
|        echo "$DESC_QUEUE."
|        ;;

The problem is when I execute exim stop and no queue-runner process is
running. Since the pid file still exists, I get an error message

|=>ROOT<=@torres:/mnt/maindisk/home/mh # /etc/init.d/exim stop
|Stopping exim on port 25: exim on port 25.
|start-stop-daemon: warning: failed to kill 3012: No such process
|exim queue-runner.
|=>ROOT<=@torres:/mnt/maindisk/home/mh #

I believe this happens because the pid file is not deleted when the
process exits. I don't understand why pid files are not deleted when
the process stops. This seems to be current practice for most daemons
(I checked with lpd, this does the same with its pid file).

How can I make start-stop-daemon check for a process' existence before
I trying to kill it? I'd really love to get rid of this error message.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


Reply to: