[Linux] for post inatallation : "openfirectl" could not kill it's process in the CentOs or Redhat system

Version 3

    [ "openfirectl" could not kill  it's process in the CentOs or Redhat system. ]

     


     

    Given "openfirectl"  could not save pid to  $OPENFIRE_PIDFILE  or  /var/run/openfire.pid file.

     

    So. /etc/rc.d/init.d/openfirectl stop  dose not kill process !!

     

    If append  this line it's PID will saved in $OPENFIRE_PIDFILE .

     

    ps -U $OPENFIRE_USER  -C openfire --no-heading  -o pid > $OPENFIRE_PIDFILE


    -------------------------------------------------------------------------------- ---------------

    by diif -urN    openfirectl.old   openfirectl.new  

     

    --- ../Archive/openfire_src/target/openfire/bin/openfirectl     2013-04-05 16:09:02.936000394 +0900
    +++ ./openfirectl.init  2013-04-05 16:17:14.786999497 +0900
    @@ -134,8 +134,13 @@
            fi

            echo
    +        ###----------------------------------------------------------------###
    +        OPENFIRE_PID=`ps -U $OPENFIRE_USER  -o pid,cmd --no-heading | grep 'DopenfireHome' | grep -v "grep"  | cut -d' ' -f1 `
    +        echo "openfire start with $OPENFIRE_PID !"
    +        echo $OPENFIRE_PID >  $OPENFIRE_PIDFILE
    +        ###----------------------------------------------------------------###

    -       [ $RETVAL -eq 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/openfire
    +       [ $OPENFIRE_PID -gt 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/openfire

            sleep 1 # allows prompt to return
            cd $OLD_PWD
    @@ -185,7 +190,12 @@
    # Handle how we were called.
    case "$CMD" in
            start)
    -               start
    +               if [ -f /var/lock/subsys/openfire ]
    +               then
    +                       restart
    +               else
    +                       start
    +               fi
                    ;;
            stop)
                    stop

     

     

    -------------------------------------------------------------------------------- ---------------

     

    cp -p openfirectl.init    /usr/local/openfire/bin/openfirectl

    cp -p openfirectl.init    /etc/rc.d/init.d/openfirectl

     

    cp -p openfire.sysconfig  /etc/sysconfig/openfire

     

     

    chmod 755 /usr/local/openfire/bin/openfirectl

     

    chkconfig add openfirectl

    chkconfig --level 435 openfirectl on