]> git.pld-linux.org Git - packages/sendmail.git/blobdiff - sendmail.init
- fixed build on without ldap
[packages/sendmail.git] / sendmail.init
index b72637bfefaebb5f6632e0926ccbc9997671e39d..0b362b4bc4ea833e98a572ee09c8fa2391b04fb5 100644 (file)
@@ -1,62 +1,86 @@
-#!/bin/sh
+#! /bin/sh
 #
 # sendmail      This shell script takes care of starting and stopping
 #               sendmail.
 #
-# chkconfig: 2345 80 30
-# description: Sendmail is a Mail Transport Agent, which is the program \
-#              that moves mail from one machine to another.
-# processname: sendmail
-# config: /etc/sendmail.cf
-# pidfile: /var/run/sendmail.pid
+# chkconfig:   2345 80 30
+# description: Sendmail is a Mail Transport Agent, which is the program \
+#              that moves mail from one machine to another.
+# pidfile:     /var/run/sendmail.pid
 
-# Source function library.
+
+# Source function library
 . /etc/rc.d/init.d/functions
 
-# Source networking configuration.
+# Get network config
 . /etc/sysconfig/network
 
-# Source sendmail configureation.
-if [ -f /etc/sysconfig/sendmail ] ; then
+# Get service config
+if [ -f /etc/sysconfig/sendmail ]; then
        . /etc/sysconfig/sendmail
 else
        DAEMON=yes
-       QUEUE=1h
+       QUEUE=1h                                                                                              
+       ENABLE_IPV6=yes
 fi
 
 # Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-
-[ -f /usr/sbin/sendmail ] || exit 0
+if is_no "${NETWORKING}"; then
+       msg_network_down Sendmail
+       exit 1
+fi
 
 # See how we were called.
 case "$1" in
   start)
-       # Start daemons.
-       echo -n "Starting sendmail: "
-       daemon /usr/sbin/sendmail $([ "$DAEMON" = yes ] && echo -bd) \
-                                  $([ -n "$QUEUE" ] && echo -q$QUEUE)
-       echo
-       touch /var/lock/subsys/sendmail
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/sendmail ]; then
+               show "Prepare sendmail db"
+               busy
+               /usr/bin/newaliases >/dev/null 2>&1
+               for i in virtusertable access domaintable mailertable; do
+                       if [ -f /etc/mail/$i ] ; then
+                               makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
+                       fi
+               done 
+               deltext;ok
+               msg_starting sendmail
+               daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \
+                                       $([ -n "$QUEUE" ] && echo -q$QUEUE) \
+                                       $([ "$ENABLE_IPV6" = "yes" ] && 
+                                               echo -ODaemonPortOptions=Family=inet6 )
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
+       else
+               msg_already_running sendmail
+               exit 1
+       fi
        ;;
   stop)
        # Stop daemons.
-       echo -n "Shutting down sendmail: "
+       msg_stopping sendmail
        killproc sendmail
-       echo
-       rm -f /var/lock/subsys/sendmail
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
        ;;
-  restart)
+  restart|reload)
        $0 stop
        $0 start
        ;;
+  condrestart)
+       if [ -f /var/lock/subsys/sendmail ]; then
+           stop
+           start
+           RETVAL=$?
+       fi
+       ;;
   status)
        status sendmail
+       RETVAL=$?
        ;;
   *)
-       echo "Usage: sendmail {start|stop|restart|status}"
+       msg_usage "$0 {start|stop|restart|reload|condrestart|status}"
        exit 1
 esac
 
-exit 0
-
+exit $RETVAL
This page took 0.029566 seconds and 4 git commands to generate.