Hi All,

I send a patch in conjunction with the status processing.
It is made the following modifications.

 * Carry out status processing in a version judgment 
 * Change of the parameter check 
 * Error log when status processing failed
 * Value set of the ret variable

I send the patch of other corrections later.

Please comment on all of you for the patch.


Best Regards,
Hideo Yamauchi.


--- On Fri, 2011/6/3, Dejan Muhamedagic <[email protected]> wrote:

> On Fri, Jun 03, 2011 at 12:03:20PM +0200, Raoul Bhatia [IPAX] wrote:
> > On 06/03/2011 11:45 AM, Dejan Muhamedagic wrote:
> > > Regressions are bad. You have to keep in mind that not everybody
> > > runs the latest release of postfix. This really needs to be fixed
> > > before the release.
> > 
> > it's no regression but has been like that since the initial release.
> > see commit e7af463d or
> > 
> > https://github.com/ClusterLabs/resource-agents/blame/master/heartbeat/postfix#LID100
> > 
> > i didn't know this until Noah brought this to my/our attention:
> > http://www.gossamer-threads.com/lists/linuxha/pacemaker/72379#72379
> 
> OK.  I misunderstood the post, it seemed to me as if status had
> been introduced in the latest set of patches.  This is another
> matter then.
> 
> Cheers,
> 
> Dejan
> 
> > thanks,
> > raoul
> > -- 
> > ____________________________________________________________________
> > DI (FH) Raoul Bhatia M.Sc.          email.          [email protected]
> > Technischer Leiter
> > 
> > IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> > Barawitzkagasse 10/2/2/11           email.            [email protected]
> > 1190 Wien                           tel.               +43 1 3670030
> > FN 277995t HG Wien                  fax.            +43 1 3670030 15
> > ____________________________________________________________________
> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
diff -r fd372ca4d647 postfix
--- a/postfix   Mon Jun 06 11:45:51 2011 +0900
+++ b/postfix   Mon Jun 06 11:46:32 2011 +0900
@@ -97,10 +97,22 @@
 
 running() {
     # run Postfix status
-    $binary $OPTION_CONFIG_DIR status >/dev/null 2>&1
+    if [ $status_suuport ]; then
+        output=`$binary $OPTION_CONFIG_DIR status`
+        if [ $? -ne 0 ]; then
+            ocf_log err "Postfix status. %s" $output
+        fi
+    else
+        PIDFILE=${queue_dir}/pid/master.pid
+        if [ -f $PIDFILE ]; then
+             PID=`head -n 1 $PIDFILE`
+             kill -s 0 $PID >/dev/null 2>&1 && [ `ps -p $PID | grep master | 
wc -l` -eq 1 ]
+             return $?
+        fi
+        false
+    fi
 }
 
-
 postfix_status()
 {
     running
@@ -219,25 +231,44 @@
         fi
     fi
 
+    # check postfix version
+    status_support=true
+    output=`postconf $OPTION_CONFIG_DIR -h mail_version`
+    if [ $? -ne 0 ]; then
+        ocf_log err "Postfix config mail_version does not exist. %s" $output
+    fi
+    ver_str=(`echo $output | tr '.' ' '`)
+    if [ ${ver_str[0]} -le 2 -a ${ver_str[1]} -le 5 ]; then
+        status_support=false
+    fi
+
     # check spool/queue and data directories
     # this is required because "postfix check" does not catch all errors
     queue_dir=`postconf $OPTION_CONFIG_DIR -h queue_directory 2>/dev/null`
-    data_dir=`postconf $OPTION_CONFIG_DIR -h data_directory 2>/dev/null`
-    for dir in "$queue_dir" "$data_dir"; do
-        if [ ! -d "$dir" ]; then
-            ocf_log err "Postfix directory '$queue_dir' does not exist." $ret
+    ret=$?
+    if [ ! -d "$queue_dir" ]; then
+        ocf_log err "Postfix directory '$queue_dir' does not exist." $ret
+        return $OCF_ERR_INSTALLED
+    fi
+    if [ ! $status_support ]; then
+        data_dir=`postconf $OPTION_CONFIG_DIR -h data_directory 2>/dev/null`
+        ret=$?
+        if [ ! -d "$data_dir" ]; then
+            ocf_log err "Postfix directory '$data_dir' does not exist." $ret
             return $OCF_ERR_INSTALLED
         fi
-    done
+    fi
 
     # check permissions
-    user=`postconf $OPTION_CONFIG_DIR -h mail_owner 2>/dev/null`
-    for dir in "$data_dir"; do
-        if ! su -s /bin/sh - $user -c "test -w $dir"; then
-            ocf_log err "Directory '$dir' is not writable by user '$user'."
-            exit $OCF_ERR_PERM;
-        fi
-    done
+    if [ ! $status_support ]; then
+        user=`postconf $OPTION_CONFIG_DIR -h mail_owner 2>/dev/null`
+        for dir in "$data_dir"; do
+            if ! su -s /bin/sh - $user -c "test -w $dir"; then
+                ocf_log err "Directory '$dir' is not writable by user '$user'."
+                exit $OCF_ERR_PERM;
+            fi
+        done
+    fi
 
     # run Postfix internal check
     $binary $OPTIONS check >/dev/null 2>&1
@@ -355,3 +386,4 @@
                 exit $OCF_ERR_UNIMPLEMENTED
                 ;;
 esac
+
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to