Ad Widget

Collapse

Bugfix: ps -ef in get_status(): -f undefined on OpenBSD

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • freak
    Member
    • Oct 2007
    • 52

    #1

    Bugfix: ps -ef in get_status(): -f undefined on OpenBSD

    Hi,

    ps -ef produces warnings on OpenBSD because -f is undefined here. (At least until 4.1, I don't currently have 4.2 to check it.)

    Possible solution a) just turn around the execs:
    PHP Code:
    --- trunk/frontends/php/include/config.inc.php.orig    2007-11-14 11:25:57.000000000 +0100
    +++ trunk/frontends/php/include/config.inc.php 2007-11-14 11:26:19.000000000 +0100
    @@ -1104,+1104,@@
                    global 
    $DB_TYPE;
                    
    $status = array();
     
    // server
    -               if( (exec("ps -ef|grep zabbix_server|grep -v grep|wc -l")>0) || (exec("ps -ax|grep zabbix_server|grep -v grep|wc -l")>0) )
    +               if( (
    exec("ps -ax|grep zabbix_server|grep -v grep|wc -l")>0) || (exec("ps -ef|grep zabbix_server|grep -v grep|wc -l")>0) )
                    {
                            
    $status["zabbix_server"] = S_YES;
                    } 
    I'm not sure what the use of these two execs was in the first place so maybe they shouldn't be turned around..

    Possible solution b) make an explicit OS-check:
    PHP Code:
    Indextrunk/frontends/php/include/config.inc.php
    ===================================================================
    --- 
    trunk/frontends/php/include/config.inc.php  (revision 75)
    +++ 
    trunk/frontends/php/include/config.inc.php  (working copy)
    @@ -
    1104,+1104,10 @@
                    global 
    $DB_TYPE;
                    
    $status = array();
     
    // server
    -               if( (exec("ps -ef|grep zabbix_server|grep -v grep|wc -l")>0) || (exec("ps -ax|grep zabbix_server|grep -v grep|wc -l")>0) )
    +               
    $psarg "-e"// ps arguments
    +               if(strcasecmp(php_uname("s"), "openbsd") != 0)
    +                       
    $psarg .= "f"// -f undefined on openbsd
    +               if( (exec("ps ".$psarg."|grep zabbix_server|grep -v grep|wc -l")>0) || (exec("ps -ax|grep zabbix_server|grep -v grep|wc -l")>0) )
                    {
                            
    $status["zabbix_server"] = S_YES;
                    } 
    Cheers
    Sebastian
Working...