On 2019-02-06 09:47, Klaus Ethgen wrote:
> did anybody already debug and fix the problem in debian that exim is
> not stopped with stop action anymore?
I run debian on my server but I compile exim from upstream source, so I
had to write my own initscript. I append it below; it seems to work
fine for my situation. It starts a combined port 25 daemon and queue
runner.
TBH, I don't use rotating logs with Exim; instead I use the setting that
makes it log into a file named after the current year and month. So the
reloading function in the initscript doesn't get much testing.
--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.
#!/bin/sh
### BEGIN INIT INFO
# Provides: mail_transport_agent
# Required-Start: $local_fs $remote_fs $network $named $time
# Required-Stop: $local_fs $remote_fs $network $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Exim initscript
# Description: Manages the Exim MTA
### END INIT INFO
# Author: Ian Zimmerman <itz@???>
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
DESC="Exim MTA"
DAEMON=/usr/local/packages/exim/bin/exim
NAME=exim
PIDFILE=/var/spool/exim4/exim-daemon.pid
DAEMON_ARGS="-bd -q20m"
EXIM_LOG_DIR=/var/log/exim4
test_exim_up()
{
sleep 2
SS_OUT=`ss -nH -f inet -t state listening '( sport = 25 )'`
case "$SS_OUT" in
('') return 2 ;;
(?*) return 0 ;;
esac
}
do_reload()
{
log_daemon_msg "Reloading $DESC configuration files" "$NAME"
$DAEMON -bV >/dev/null 2>/dev/null && \
start-stop-daemon --oknodo --stop --signal HUP --quiet \
--pidfile "$PIDFILE" --exec "$DAEMON"
EXIM_HUP_STATUS=$?
test_exim_up || EXIM_HUP_STATUS=1
log_end_msg $EXIM_HUP_STATUS
}
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
do_start_cmd_override() {
start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \
$START_ARGS \
--startas $DAEMON --name $NAME --exec $DAEMON --test > /dev/null \
|| return 1
$DAEMON -bV >/dev/null 2>/dev/null || return 2
start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \
$START_ARGS \
--startas $DAEMON --name $NAME --exec $DAEMON -- $DAEMON_ARGS \
|| return 2
test_exim_up
}
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi