]> git.pld-linux.org Git - packages/postfix.git/commitdiff
- use functions; only starting and restarting requires networking check.
authorPaweł Gołaszewski <blues@pld-linux.org>
Mon, 26 Jan 2009 21:13:05 +0000 (21:13 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  There is no need to check it while stopping or rebuilding databases (man
  can do this completelly offline).

Changed files:
    postfix.init -> 1.22

postfix.init

index 10671edc7f84a05366fc0f25f22b123bc9c198b5..6533196352f816ce806d87657e85fbda141a2e2a 100644 (file)
 [ -f /etc/sysconfig/postfix ] && . /etc/sysconfig/postfix
 
 # 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 Postfix
-               exit 1
+networking_check() {
+       if is_yes "${NETWORKING}"; then
+               if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+                       msg_network_down Postfix
+                       exit 1
+               fi
+       else
+               exit 0
        fi
-else
-       exit 0
-fi
+}
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-       # Check if the service is already running?
+start() {
        if [ ! -f /var/lock/subsys/postfix ]; then
                msg_starting Postfix
                busy
@@ -48,9 +46,9 @@ case "$1" in
        else
                msg_already_running Postfix
        fi
-       ;;
-  stop)
-       # Stop daemons.
+}
+
+stop() {
        if [ -f /var/lock/subsys/postfix ]; then
                msg_stopping Postfix
                busy
@@ -65,13 +63,26 @@ case "$1" in
        else
                msg_not_running Postfix
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       networking_check
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
+       networking_check
+       stop
+       start
        exit $?
        ;;
   reload|force-reload)
+       networking_check
        if [ -f /var/lock/subsys/postfix ]; then
                msg_reloading Postfix
                daemon /usr/sbin/postfix reload
This page took 0.141041 seconds and 4 git commands to generate.