]> git.pld-linux.org Git - packages/sendmail.git/blobdiff - sendmail.init
- cosmetics
[packages/sendmail.git] / sendmail.init
index b64f99e8499b0b1ac92e5cedf35acad0249071ce..34127ced3ce41acd355e75167836ac34afc25914 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 #
-# sendmail      This shell script takes care of starting and stopping
-#               sendmail.
+# 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 \
 . /etc/sysconfig/network
 
 # Get service config
-[ -f /etc/sysconfig/sendmail ] && . /etc/sysconfig/sendmail
+if [ -f /etc/sysconfig/sendmail ]; then
+       . /etc/sysconfig/sendmail
+else
+       DAEMON=yes
+       QUEUE=1h
+       ENABLE_IPV6=yes
+fi
 
 # Check that networking is up.
-[ "${NETWORKING}" = "no" ] && echo "Error: Networking is down" && exit 0
-
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down Sendmail
+               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/sendmail ]; then
-               show Prepare sendmail db
+               show "Prepare sendmail db"
                busy
-               newaliases &>/dev/null
+               /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
+                       if [ -f /etc/mail/$i ]; then
+                               makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
+                               [ $RETVAL -eq 0 ] && RETVAL=$?
                        fi
                done 
-               deltext;ok
-               show Starting sendmail
-               daemon sendmail $SENDMAIL_CF
+               [ $RETVAL -eq 0 ] && ok || fail
+               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
-               echo "sendmail already is running"
+               msg_already_running sendmail
        fi
-       touch /var/lock/subsys/sendmail
        ;;
   stop)
-       # Stop daemons.
-       show Shutting down sendmail
-       killproc sendmail
-       rm -f /var/lock/subsys/sendmail
+       if [ -f /var/lock/subsys/sendmail ]; then
+               # Stop daemons.
+               msg_stopping sendmail
+               killproc sendmail
+               rm -f /var/lock/subsys/sendmail
+       else
+               msg_not_running sendmail
+       fi
        ;;
-  restart|reload)
+  restart|force-reload)
        $0 stop
        $0 start
+       exit $?
        ;;
   status)
        status sendmail
+       exit $?
        ;;
   *)
-       echo "Usage: $0 {start|stop|staus|restart|reload}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
 esac
 
-exit 0
-
+exit $RETVAL
This page took 0.071283 seconds and 4 git commands to generate.