5 # description: IMAP Daemon
7 sysconfdir=@sysconfdir@
8 libexecdir=@libexecdir@
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20 msg_network_down "Courier IMAP"
28 # See how we were called.
31 # Check if the service is already running?
32 if [ ! -f /var/lock/subsys/courier-imap ]; then
37 if test -f $sysconfdir/imapd
46 $libexecdir/imapd.rc start
48 if [ $RETVAL -eq 0 ]; then ok; else fail; fi
52 if test -f $sysconfdir/imapd-ssl
54 . $sysconfdir/imapd-ssl
57 case x$IMAPDSSLSTART in
59 if test -x $COURIERTLS
61 # First time we start this, generate a dummy SSL certificate.
62 if test ! -f $TLS_CERTFILE
64 echo -n " generating-SSL-certificate..."
65 $sbindir/mkimapdcert >/dev/null 2>&1
67 msg_starting imapd-ssl
68 $libexecdir/imapd-ssl.rc start
70 if [ $RETVAL -eq 0 ]; then ok; else fail; fi
76 touch /var/lock/subsys/courier-imap
78 msg_already_running "Courier IMAP"
82 if [ -f /var/lock/subsys/courier-imap ]; then
85 if [ -f $PIDFILE ]; then
87 $libexecdir/imapd.rc stop
89 if [ $RETVAL -eq 0 ]; then
97 . $sysconfdir/imapd-ssl
98 if [ -f $SSLPIDFILE ]; then
99 msg_stopping imapd-ssl
100 $libexecdir/imapd-ssl.rc stop
102 if [ $RETVAL -eq 0 ]; then
110 rm -f /var/lock/subsys/courier-imap
112 msg_not_running "Courier IMAP"
115 restart|force-reload)
125 msg_usage "$0 {start|stop|restart|force-reload|status}"