Cherrypick from master 2003-07-07 00:22:46 UTC ankry <ankry@pld-linux.org> '- fixed previous change':
courier-imap-authdaemon.init -> 1.10
courier-imap-pop3.init -> 1.10
courier-imap.init -> 1.14
--- /dev/null
+#!/bin/sh
+# IMAP Auth Daemon
+#
+# chkconfig: 345 80 20
+# description: IMAP Auth Daemon
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+METHOD="plain"
+
+[ -f /etc/sysconfig/authdaemon ] && . /etc/sysconfig/authdaemon
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down "Courier IMAP - Authdaemon"
+ exit 1
+ fi
+else
+ exit 0
+fi
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/authdaemon ]; then
+ msg_starting "Courier IMAP - Authdaemon"
+ daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD start
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/authdaemon
+ else
+ msg_already_running "Courier IMAP - Authdaemon"
+ fi
+ ;;
+ stop)
+ if [ -f /var/lock/subsys/authdaemon ]; then
+ msg_stopping "Courier IMAP - Authdaemon"
+ daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD stop
+ rm -f /var/lock/subsys/authdaemon
+ else
+ msg_not_running "Courier IMAP - Authdaemon"
+ fi
+ ;;
+ restart|force-reload)
+ # restart related services, if running..
+ if [ -f /var/lock/subsys/courier-mta -a \
+ -x /etc/rc.d/init.d/courier-mta ]; then
+ /etc/rc.d/init.d/courier-mta stop
+ crun=1
+ fi
+ if [ -f /var/lock/subsys/courier-imap -a \
+ -x /etc/rc.d/init.d/courier-imap ]; then
+ /etc/rc.d/init.d/courier-imap stop
+ imaprun=1
+ fi
+ if [ -f /var/lock/subsys/courier-pop3 -a \
+ -x /etc/rc.d/init.d/courier-pop3 ]; then
+ /etc/rc.d/init.d/courier-pop3 stop
+ poprun=1
+ fi
+ $0 stop
+ $0 start
+ RETVAL=$?
+ [ "$imaprun" -eq 1 ] && /etc/rc.d/init.d/courier-imap start
+ [ "$poprun" -eq 1 ] && /etc/rc.d/init.d/courier-pop3 start
+ [ "$crun" -eq 1 ] && /etc/rc.d/init.d/courier-mta start
+ unset crun
+ unset poprun
+ unset imaprun
+ ;;
+ status)
+ status authdaemond.$METHOD
+ exit $?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|force-reload|status}"
+ exit 3
+ ;;
+esac
+
+exit $RETVAL
--- /dev/null
+#!/bin/sh
+# POP3 Daemon
+#
+# chkconfig: 345 80 20
+# description: POP3 Daemon
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+ADDRESS=0.0.0.0
+MAXPERIP=4
+MAXDAEMONS=40
+MAILDIR="Maildir"
+TCPDOPTS=
+POP3DSSLSTART="no"
+
+# Get service config
+[ -f /etc/sysconfig/courier-pop3 ] && . /etc/sysconfig/courier-pop3
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down "Courier POP3"
+ exit 1
+ fi
+else
+ exit 0
+fi
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/courier-pop3 ]; then
+ # start authdaemon, if not running..
+ if [ ! -f /var/lock/subsys/authdaemon -a \
+ -x /etc/rc.d/init.d/authdaemon ]; then
+ /etc/rc.d/init.d/authdaemon start
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ]; then
+ msg_starting "Courier POP3"
+ fail
+ exit 1
+ fi
+ fi
+ msg_starting "Courier POP3"
+ /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-pop3 ; \
+ POP3_STARTTLS=$POP3DSTARTTLS ; export POP3_STARTTLS ; \
+ `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-pop3 | \
+ sed 's/=.*//;s/^/export /;s/$/;/'` \
+ /usr/lib/courier-imap/couriertcpd -address=$ADDRESS \
+ -stderrlogger=/usr/lib/courier-imap/courierlogger \
+ -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+ -pid=/var/run/pop3d.pid $TCPDOPTS 110 /usr/sbin/pop3login \
+ /usr/lib/courier-imap/authlib/authdaemon /usr/bin/pop3d $MAILDIR"
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ ok
+ else
+ fail
+ fi
+
+ if is_yes "$POP3DSSLSTART"; then
+ msg_starting "Courier POP3 (SSL)"
+ /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-pop3 ; \
+ POP3_TLS=1; export POP3_TLS; \
+ `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-pop3 | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+ /usr/lib/courier-imap/couriertcpd -address=$ADDRESS \
+ -stderrlogger=/usr/lib/courier-imap/courierlogger \
+ -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+ -pid=/var/run/pop3d-ssl.pid $TCPDOPTS \
+ 995 /usr/bin/couriertls -server -tcpd \
+ /usr/sbin/pop3login /usr/lib/courier-imap/authlib/authdaemon \
+ /usr/bin/pop3d $MAILDIR"
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ ok
+ else
+ fail
+ fi
+ fi
+ touch /var/lock/subsys/courier-pop3
+ else
+ msg_already_running "Courier POP3"
+ fi
+ ;;
+ stop)
+ if [ -f /var/lock/subsys/courier-pop3 ]; then
+ msg_stopping "Courier POP3"
+ daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/pop3d.pid -stop
+ if is_yes "$POP3DSSLSTART"; then
+ msg_stopping "Courier POP3 (SSL)"
+ daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/pop3d-ssl.pid -stop
+ fi
+ rm -f /var/lock/subsys/courier-pop3
+ else
+ msg_not_running "Courier POP3"
+ fi
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ exit $?
+ ;;
+ status)
+ status couriertcpd
+ exit $?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|force-reload|status}"
+ exit 3
+esac
+
+exit $RETVAL
--- /dev/null
+#!/bin/sh
+# IMAP Daemon
+#
+# chkconfig: 345 80 20
+# description: IMAP Daemon
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+ADDRESS=0.0.0.0
+MAXPERIP=4
+MAXDAEMONS=40
+MAILDIR="Maildir"
+TCPDOPTS=
+IMAPDSSLSTART="no"
+
+# Get service config
+[ -f /etc/sysconfig/courier-imap ] && . /etc/sysconfig/courier-imap
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down "Courier IMAP"
+ exit 1
+ fi
+else
+ exit 0
+fi
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/courier-imap ]; then
+ # start authdaemon, if not running..
+ if [ ! -f /var/lock/subsys/authdaemon -a \
+ -x /etc/rc.d/init.d/authdaemon ]; then
+ /etc/rc.d/init.d/authdaemon start
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ]; then
+ msg_starting "Courier IMAP"
+ fail
+ exit 1
+ fi
+ fi
+ msg_starting "Courier IMAP"
+ busy
+ ulimit -d $IMAP_ULIMITD
+ /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-imap ; \
+ `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-imap | \
+ sed 's/=.*//;s/^/export /;s/$/;/'` \
+ /usr/lib/courier-imap/couriertcpd -address=$ADDRESS \
+ -stderrlogger=/usr/lib/courier-imap/courierlogger \
+ -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+ -pid=/var/run/imapd.pid $TCPDOPTS $PORTS /usr/sbin/imaplogin \
+ /usr/lib/courier-imap/authlib/authdaemon /usr/bin/imapd $MAILDIR"
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ ok
+ else
+ fail
+ fi
+
+
+ if is_yes "$IMAPDSSLSTART"; then
+ msg_starting "Courier IMAP (SSL)"
+ /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-imap ; \
+ IMAP_TLS=1; export IMAP_TLS; \
+ `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-imap | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+ /usr/lib/courier-imap/couriertcpd -address=$ADDRESS_SSL \
+ -stderrlogger=/usr/lib/courier-imap/courierlogger \
+ -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
+ -pid=/var/run/imapd-ssl.pid $TCPDOPTS \
+ $PORTS_SSL $COURIERTLS -server -tcpd \
+ /usr/sbin/imaplogin /usr/lib/courier-imap/authlib/authdaemon \
+ /usr/bin/imapd $MAILDIR"
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ ok
+ else
+ fail
+ fi
+ fi
+ touch /var/lock/subsys/courier-imap
+ else
+ msg_already_running "Courier IMAP"
+ fi
+ ;;
+ stop)
+ if [ -f /var/lock/subsys/courier-imap ]; then
+ msg_stopping "Courier IMAP"
+ daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/imapd.pid -stop
+ if is_yes "$IMAPDSSLSTART"; then
+ msg_stopping "Courier IMAP (SSL)"
+ daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/imapd-ssl.pid -stop
+ fi
+ rm -f /var/lock/subsys/courier-imap
+ else
+ msg_not_running "Courier IMAP"
+ fi
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ exit $?
+ ;;
+ status)
+ status couriertcpd
+ exit $?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|force-reload|status}"
+ exit 3
+esac
+
+exit $RETVAL