Hi All,

I revised the first patch.
Please confirm contents.

Best Regards,
Hideo Yamauchi.


--- On Tue, 2011/6/7, [email protected] <[email protected]> 
wrote:

> Hi Raoul,
> 
> Thank you for comment.
> 
> > i think we could safely do the "kill -s 0" for *any*
> > version and call "postfix status" only if available.
> 
> I think so.
> 
> However, I do not know a lot about postfix so.
> I want the opinion of the detailed person.
> 
> > btw. quickly looking at your patch, i spotted 1
> > typo: "status_suuport" instead of "status_support"
> > (douple u/p)
> 
> Sorry...
> It is my typo.
>  
> > for the version check, i think we should try using the
> > ocf internal function.
> 
> Ok.
> 
> > 
> > >  * Change of the parameter check
> > the checks are basically fine. i would slightly update the
> > logging information. (i can do this when i apply your patches)
> 
> Thanks!
> 
> > 
> > >  * Error log when status processing failed
> > >  * Value set of the ret variable
> > 
> > i don't think that the use of $ret is correct.
> 
> I made modifications to set unsettled ret variable in an original resource 
> agent. 
> But I am unsettled, the ret variable may not have to output it in log.
> 
> Best Regards,
> Hideo Yamauchi.
> 
> --- On Mon, 2011/6/6, Raoul Bhatia [IPAX] <[email protected]> wrote:
> 
> > Hi Hideo-san!
> > 
> > On 06/06/2011 04:51 AM, [email protected] wrote:
> > > 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
> > 
> > i think we could safely do the "kill -s 0" for *any*
> > version and call "postfix status" only if available.
> > 
> > btw. quickly looking at your patch, i spotted 1
> > typo: "status_suuport" instead of "status_support"
> > (douple u/p)
> > 
> > for the version check, i think we should try using the
> > ocf internal function.
> > 
> > >  * Change of the parameter check
> > the checks are basically fine. i would slightly update the
> > logging information. (i can do this when i apply your patches)
> > 
> > >  * Error log when status processing failed
> > >  * Value set of the ret variable
> > 
> > i don't think that the use of $ret is correct.
> > 
> > please comment on my suggestions and/or update the
> > ra in this regard.
> > 
> > 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 a18d987956c7 postfix
--- a/postfix   Tue Jun 07 11:07:11 2011 +0900
+++ b/postfix   Tue Jun 07 11:13:16 2011 +0900
@@ -97,10 +97,25 @@
 
 running() {
     # run Postfix status
-    $binary $OPTION_CONFIG_DIR status >/dev/null 2>&1
+    local rcode
+    if ocf_is_true $status_support; then
+        output=`$binary $OPTION_CONFIG_DIR status`
+        rcode=$?
+        if [ $rcode -ne 0 ]; then
+            ocf_log err "Postfix status: $output"
+        fi
+        return $rcode
+    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 +234,42 @@
         fi
     fi
 
+    # check postfix version
+    status_support=false
+    output=`postconf $OPTION_CONFIG_DIR -h mail_version`
+    if [ $? -ne 0 ]; then
+        ocf_log err "Postfix config mail_version does not exist. $output"
+    fi
+    ocf_version_cmp "$output" "2.5.0"
+    if [ $? -ne 0 ]; then
+        status_support=true
+    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
+    if [ ! -d "$queue_dir" ]; then
+        ocf_log err "Postfix directory '$queue_dir' does not exist."
+        return $OCF_ERR_INSTALLED
+    fi
+    if ocf_is_true $status_support; then
+        data_dir=`postconf $OPTION_CONFIG_DIR -h data_directory 2>/dev/null`
+        if [ ! -d "$data_dir" ]; then
+            ocf_log err "Postfix directory '$data_dir' does not exist."
             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 ocf_is_true $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
_______________________________________________________
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