File qmail-pop3-initscript of Package netqmail
#!/bin/sh
#
# init.d/netqmail-pop3d
#
# Handles tcpserver for qmail-pop3d
#
# (C) 2011-2012 Peter Conrad <conrad@quisquis.de>
#
# This file 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: netqmail-pop3d
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Description: Start qmail's POP3 daemon
# Short-Description: Start POP3 daemon
### 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
}
fi
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
# running name pidfile
running() {
if [ ! -r "$2" ]; then
return 1
fi
read pid <"$2"
if [ -z "$pid" ]; then
return 1
fi
if [ ! -r "/proc/$pid/cmdline" ]; then
return 1
fi
grep -q "$1" "/proc/$pid/cmdline"
}
case "$1" in
start)
echo -n "Starting qmail-pop3d..."
if running qmail-pop3d /var/run/qmail-pop3d.pid; then
:
else
(( env - PATH=@QMAIL_EXECDIR@:$PATH \
@QMAIL_EXECDIR@/start-pop3-tcpserver &
echo $! >/var/run/qmail-pop3d.pid ) | \
@QMAIL_EXECDIR@/splogger pop3d 3 ) &
fi
rc_status -v
;;
stop)
echo -n "Shutting down qmail-pop3ds..."
if running qmail-pop3d "/var/run/qmail-pop3d.pid"; then
kill `cat "/var/run/qmail-pop3d.pid"`
rm "/var/run/qmail-pop3d.pid"
fi
rc_status -v
;;
restart)
"$0" stop && "$0" start
;;
condrestart|try-restart)
if running qmail-pop3d /var/run/qmail-pop3d.pid; then
"$0" restart
fi
;;
reload|force-reload)
# Control files are re-read for every new connection
;;
status)
if running qmail-pop3d /var/run/qmail-pop3d.pid; then
exit 0
fi
if [ -r "/var/run/qmail-pop3d.pid" ]; then
exit 1
fi
exit 2
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
exit 1
esac
exit 0