File qmail-send-initscript of Package netqmail
#!/bin/sh
#
# init.d/qmail-send
#
# Using splogger to send the log through syslog.
# Using qmail-local to deliver messages to ~/Maildir/ by default.
#
# (C) 2011-2012 Peter Conrad <conrad@quisquis.de>
#
# This program is licensed under the terms of the
# GNU General Public License Version 2. A copy of these terms should be
# enclosed as "gpl-2.0.txt" in the package containing this file.
#
### BEGIN INIT INFO
# Provides: qmail-send
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 5
# Default-Stop: 0 1 4 6
# Description: Start qmail's queue manager
# Short-Description: Start qmail-send
### END INIT INFO
if [ -r /etc/rc.status ]; then
. /etc/rc.status
rc_reset
elif [ -r /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
rc_status () {
stat=$?
if [ "$1" = "-v" ]; then
case "$stat" in
0) log_success_msg; ;;
1|2) log_failure_msg; ;;
*) log_warning_msg; ;;
esac
fi
}
getpids () {
ls -l /proc/*/exe 2>/dev/null | grep " -> $1\$" | sed 's=^.* /proc/==;s=/.*=='
}
checkproc () {
test "`getpids $1`" != ""
}
killproc () {
sig="$1"
case "$1" in
-TERM) sig=-15; ;;
-ALRM) sig=-14; ;;
-HUP) sig=-1; ;;
esac
kill "$sig" `getpids $2`
}
fi
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
case "$1" in
start)
echo -n "Starting qmail..."
if ! checkproc @QMAIL_EXECDIR@/qmail-send; then
env - PATH="@QMAIL_EXECDIR@:$PATH" \
qmail-start ./Maildir/ splogger qmail &
fi
rc_status -v
;;
stop)
echo -n "Shutting down qmail..."
killproc -TERM @QMAIL_EXECDIR@/qmail-send
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload|reload)
echo -n "Reload qmail's locals and virtualdomains..."
killproc -HUP @QMAIL_EXECDIR@/qmail-send
#$0 stop && $0 start
rc_status -v
;;
status)
checkproc @QMAIL_EXECDIR@/qmail-send
rc_status -v
;;
run-queue)
killproc -ALRM @QMAIL_EXECDIR@/qmail-send
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status|run-queue}"
exit 1
esac
exit 0