[csw-devel] SF.net SVN: gar:[8798] csw/mgar/pkg/postfix/branches/postfix-2.6/files/ cswpostfix

bensons at users.sourceforge.net bensons at users.sourceforge.net
Wed Feb 24 18:06:25 CET 2010


Revision: 8798
          http://gar.svn.sourceforge.net/gar/?rev=8798&view=rev
Author:   bensons
Date:     2010-02-24 17:06:25 +0000 (Wed, 24 Feb 2010)

Log Message:
-----------
postfix: extended init script

Modified Paths:
--------------
    csw/mgar/pkg/postfix/branches/postfix-2.6/files/cswpostfix

Modified: csw/mgar/pkg/postfix/branches/postfix-2.6/files/cswpostfix
===================================================================
--- csw/mgar/pkg/postfix/branches/postfix-2.6/files/cswpostfix	2010-02-24 16:42:46 UTC (rev 8797)
+++ csw/mgar/pkg/postfix/branches/postfix-2.6/files/cswpostfix	2010-02-24 17:06:25 UTC (rev 8798)
@@ -10,7 +10,7 @@
 # cswclassutils settings
 #AUTOENABLE NO
 
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/csw/sbin
 CFGDIR=/etc/opt/csw/postfix
 DAEMON=/opt/csw/sbin/postfix
 PIDFILE=/var/opt/csw/run/postfix.pid
@@ -18,22 +18,34 @@
 TZ=
 unset TZ
 
-test -x $DAEMON -a -f /etc/opt/csw/postfix/main.cf || exit 0
+test -x ${DAEMON} -a -f ${CFGDIR}/main.cf || exit 0
 
+running() {
+    queue=`/opt/csw/sbin/postconf -c ${CFGDIR} -h queue_directory 2>/dev/null`
+    if [ -f ${queue}/pid/master.pid ]; then
+        pid=`sed 's/ //g' ${queue}/pid/master.pid`
+        # what directory does the executable live in.  stupid prelink systems.
+        pspid=`ps -fp $pid -o pid | sed -n '/[0-9]/{s/ //g;p;}'`
+        if [ "X$pid" = "X$pspid" ]; then
+            /bin/echo y
+        fi
+    fi
+}
+
 case "$1" in
     start)
-        if [ ! -f $CFGDIR/aliases.dir ]; then
+        if [ ! -f ${CFGDIR}/aliases.dir ]; then
          /opt/csw/bin/newaliases
         fi
 
         /bin/echo "Starting mail transport agent: Postfix"
-        ${DAEMON} start 2>&1 |
+        ${DAEMON} -c ${CFGDIR} start 2>&1 |
                 (grep -v 'starting the Postfix' 1>&2 || /bin/true)
     ;;
 
     stop)
         /bin/echo "Stopping mail transport agent: Postfix"
-        ${DAEMON} stop 2>&1 |
+        ${DAEMON} -c ${CFGDIR} stop 2>&1 |
                 (grep -v 'stopping the Postfix' 1>&2 || /bin/true)
     ;;
 
@@ -44,21 +56,32 @@
     
     force-reload|reload)
         /bin/echo "Reloading Postfix configuration..."
-        ${DAEMON} reload 2>&1 |
+        ${DAEMON} -c ${CFGDIR} reload 2>&1 |
                 (grep -v 'refreshing the Postfix' 1>&2 || /bin/true)
-        echo "done."
+        /bin/echo "done."
     ;;
 
     flush)
-        ${DAEMON} flush
+        ${DAEMON} -c ${CFGDIR} flush
     ;;
 
     check)
-        ${DAEMON} check
+        ${DAEMON} -c ${CFGDIR} check
     ;;
 
+    status)
+        RUNNING=`running`
+        if [ -n "$RUNNING" ]; then
+           /bin/echo "postfix is running"
+           exit 0
+        else
+           /bin/echo "postfix is not running"
+           exit 3
+        fi
+    ;;
+
     *)
-        echo "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|force-reload}"
+        /bin/echo "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|status|force-reload}"
         exit 1
     ;;
 esac


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list