SHA256
1
0
forked from pool/courier-imap
courier-imap/courier-pop-ssl.init

108 lines
2.9 KiB
Bash

#! /bin/sh
# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All rights reserved.
#
# Author: Thorsten Kukuk <feedback@suse.de>
#
# /etc/init.d/courier-pop-ssl
#
### BEGIN INIT INFO
# Provides: courier-pop-ssl
# Required-Start: $syslog $remote_fs courier-authdaemon
# X-UnitedLinux-Should-Start:
# Required-Stop: $syslog $remote_fs
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Courier-POP3 server for SSL connections
# Description: Start the Courier-POP3 server, which is an
# POP3 server for Maildir mailboxes. This
# version only accepts SSL connections.
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
POP3_BIN=/usr/sbin/pop3d
test -x $POP3_BIN || exit 5
. /etc/rc.status
# Read configuration
TLS_CACHEFILE=""
. /etc/courier/pop3d
. /etc/courier/pop3d-ssl
test "$MAILDIRPATH" == "" && MAILDIRPATH=Maildir
test "$PIDFILE" == "" && PIDFILE=/var/run/pop3d.pid
test "$SSLPIDFILE" == "" && PIDFILE=/var/run/pop3d-ssl.pid
# Reset status of this service
rc_reset
case "$1" in
start)
/etc/init.d/courier-authdaemon status > /dev/null || /etc/init.d/courier-authdaemon start
echo -n "Starting Courier-POP3 (SSL)"
if test ! -f $TLS_CERTFILE
then
echo -n " generating-SSL-certificate..."
/usr/sbin/mkpop3dcert >/dev/null 2>&1
fi
if test "$TLS_CACHEFILE" != ""
then
rm -f $TLS_CACHEFILE
fi
ulimit -v $POP3_ULIMITD
/usr/bin/env - /bin/sh -c " set -a ;
. /etc/courier/pop3d ; \
. /etc/courier/pop3d-ssl ; \
POP3_TLS=1; POP3_STARTTLS=NO; POP3_TLS_REQUIRED=0; \
PROXY_HOSTNAME=$PROXY_HOSTNAME ; \
/usr/sbin/courierlogger -pid=$SSLPIDFILE -start $LOGGEROPTS \
/usr/lib/courier-imap/couriertcpd -address=$SSLADDRESS \
-maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP $TCPDOPTS \
$SSLPORT $COURIERTLS -server -tcpd \
/usr/sbin/pop3login $POP3_BIN ${MAILDIRPATH}"
rc_status -v
;;
stop)
echo -n "Shutting down Courier-POP3 (SSL)"
/usr/sbin/courierlogger -pid=$SSLPIDFILE -stop
rc_status -v
rm -f $SSLPIDFILE{,.lock}
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
echo -n "Reload Courier-POP3 (SSL)"
$0 stop && $0 start
rc_status
;;
reload)
echo -n "Reload Courier-POP3 (SSL)"
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for Courier-POP3 (SSL)"
/sbin/checkproc -k -p $PIDFILE /usr/sbin/courierlogger
if [ $? -eq 7 ]; then
rc_failed 3
fi;
rc_status -v
;;
probe)
test /etc/courier/pop3d -nt $SSLPIDFILE && echo restart
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit