]> git.pld-linux.org Git - packages/courier-imap.git/blobdiff - courier-imap-pop3.init
- updated to 4.10.0
[packages/courier-imap.git] / courier-imap-pop3.init
index e1cc2b837e3069905bd9a464b713186fca94cf64..dbda27c1f11c8d924136a5e32089b793135ba6f6 100644 (file)
 # chkconfig:   345 80 20
 # description: POP3 Daemon
 
+sysconfdir=@sysconfdir@
+libexecdir=@libexecdir@
+sbindir=@sbindir@
+
 # 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"
+               msg_network_down "Courier POP3D"
                exit 1
        fi
 else
        exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
+       if [ -f /var/lock/subsys/courier-pop3 ]; then
+               msg_already_running "Courier POP3D"
+               return
+       fi
+
+       msg_starting "Courier POP3D"
+       daemon $libexecdir/pop3d.rc start
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-pop3
+}
+
+stop() {
        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
+               msg_not_running "Courier POP3D"
+               return
+       fi
+
+       msg_stopping "Courier POP3D"
+       daemon $libexecdir/pop3d.rc stop
+       RETVAL=$?
+       rm -f /var/lock/subsys/courier-pop3 >/dev/null 2>&1
+}
 
-               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"
+condrestart() {
+       if [ ! -f /var/lock/subsys/courier-pop3 ]; then
+               msg_not_running "Courier POP3D"
+               RETVAL=$1
+               return
        fi
+
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
   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
+       stop
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  restart)
+       stop
+       start
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status couriertcpd
        exit $?
        ;;
-  *)
+*)
        msg_usage "$0 {start|stop|restart|force-reload|status}"
        exit 3
 esac
This page took 0.065475 seconds and 4 git commands to generate.