1# /bin/sh 2# 3# This is a sample /etc/init.d file for Courier-IMAP server 4# on SuSE systems. 5# 6# description: Courier-IMAP - IMAP server 7# 8# /etc/init.d/courier-imap 9# 10### BEGIN INIT INFO 11# Provides: cyrus courier-imap 12# Required-Start: $network $named $syslog 13# X-UnitedLinux-Should-Start: ldap ypbind 14# Required-Stop: 15# Default-Start: 3 5 16# Default-Stop: 17# Description: start the Courier-imap mail delivery agent 18### END INIT INFO 19 20# Determine the base and follow a runlevel link name. 21base=${0##*/} 22link=${base#*[SK][0-9][0-9]} 23 24COURIER_ETC=@sysconfdir@ 25COURIER_LIBEXEC=@libexecdir@ 26COURIER_DATAROOT=@datarootdir@ 27COURIER_DATA=@datadir@ 28COURIER_BIN=@bindir@/imapd 29 30if [ ! -x $COURIER_BIN ] ; then 31 echo -n "courier-imap server not installed ! " 32 exit 5 33fi 34 35. /etc/rc.status 36rc_reset 37 38case "$1" in 39start) 40 cd / 41 . ${COURIER_ETC}/imapd 42 touch /var/lock/subsys/courier-imap 43 44 echo -n "Starting Courier-IMAP server:" 45 46 case x$IMAPDSTART in 47 x[yY]*) 48 # Start daemons. 49 ${COURIER_LIBEXEC}/imapd.rc start 50 echo -n " imap" 51 ;; 52 esac 53 54 . ${COURIER_ETC}/imapd-ssl 55 case x$IMAPDSSLSTART in 56 x[yY]*) 57 if test -x $COURIERTLS 58 then 59 60 # First time we start this, generate a dummy SSL certificate. 61 62 if test ! -f $TLS_DHPARAMS 63 then 64 echo " dhparams" 65 ${COURIER_DATA}/mkdhparams 66 fi 67 68 if test ! -f $TLS_CERTFILE 69 then 70 echo -n " generating-SSL-certificate..." 71 ${COURIER_DATA}/mkimapdcert >/dev/null 2>&1 72 fi 73 ${COURIER_LIBEXEC}/imapd-ssl.rc start 74 echo -n " imap-ssl" 75 fi 76 ;; 77 esac 78 79 POP3DSTART="" 80 POP3DSSLSTART="" 81 82 if test -f ${COURIER_ETC}/pop3d 83 then 84 . ${COURIER_ETC}/pop3d 85 fi 86 87 case x$POP3DSTART in 88 x[yY]*) 89 # Start daemons. 90 ${COURIER_LIBEXEC}/pop3d.rc start 91 echo -n " pop3" 92 ;; 93 esac 94 95 if test -f ${COURIER_ETC}/pop3d-ssl 96 then 97 . ${COURIER_ETC}/pop3d-ssl 98 fi 99 100 case x$POP3DSSLSTART in 101 x[yY]*) 102 if test -x $COURIERTLS 103 then 104 105 # First time we start this, generate a dummy SSL certificate. 106 107 if test ! -f $TLS_CERTFILE 108 then 109 echo -n " generating-SSL-certificate..." 110 ${COURIER_DATA}/mkpop3dcert >/dev/null 2>&1 111 fi 112 ${COURIER_LIBEXEC}/pop3d-ssl.rc start 113 echo -n " pop3-ssl" 114 fi 115 ;; 116 esac 117 118 echo "" 119 ;; 120stop) 121 echo -n "Stopping Courier-IMAP server:" 122 . ${COURIER_ETC}/imapd 123 . ${COURIER_ETC}/imapd-ssl 124 ${COURIER_LIBEXEC}/imapd.rc stop 125 echo -n " imap" 126 if test -x $COURIERTLS 127 then 128 ${COURIER_LIBEXEC}/imapd-ssl.rc stop 129 echo -n " imap-ssl" 130 fi 131 132 if test -f ${COURIER_ETC}/pop3d 133 then 134 ${COURIER_LIBEXEC}/pop3d.rc stop 135 echo -n " pop3" 136 137 if test -x $COURIERTLS 138 then 139 ${COURIER_LIBEXEC}/pop3d-ssl.rc stop 140 echo -n " pop3-ssl" 141 fi 142 fi 143 144 echo "" 145 ;; 146restart) 147 $0 stop 148 $0 start 149 ;; 150esac 151exit 0 152