Ticket #864 (closed defect: fixed)

Opened 13 years ago

Last modified 13 years ago

service bcfg2-server status returns incorrect results

Reported by: Owned by: solj
Priority: major Milestone: Bcfg2 1.1.0 Release
Component: bcfg2-server Version: 1.0
Keywords: Cc: [email protected]


Bcfg2 v1.0.1-1 on a RHEL system. running /etc/init.d/bcfg2-server status returns a "is running" method whether bcfg2-server is running or not.

Adding a "ps -ef | grep $PID" to line 77 of the script to examine which process that the status function thinks is "running" shows that its the /etc/init.d script that matches.

[[email protected] ~]# uname -a
Linux rhel 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# rpm -q bcfg2-server
[[email protected] ~]# service bcfg2-server status
bcfg2-server (pid 8153) is running...
root      8153  8148  0 10:57 pts/0    00:00:00 /bin/sh /etc/init.d/bcfg2-server status
root      8156  8153  0 10:57 pts/0    00:00:00 ps -ef
root      8157  8153  0 10:57 pts/0    00:00:00 grep 8153

To fix this adding a the "-o %PPID" flag to the pidof call eliminates the parent process from pidof's process list.

[[email protected] ~] diff /etc/init.d/bcfg2-server /etc/init.d/bcfg2-server.orig
<    PID=$(pidof -x $BINARY -o %PPID)
>    PID=$(pidof -x $BINARY)
[[email protected] ~] service bcfg2-server status
bcfg2-server is not running                               [FAILED]


Change History

comment:1 Changed 13 years ago by solj

  • Owner changed from desai to solj
  • Status changed from new to accepted

comment:2 Changed 13 years ago by solj

  • Status changed from accepted to closed
  • Resolution set to fixed

Applied in [1aa352a48cf606c379da3e038c94b24b9c55eb56] (SVN r5780). Thanks for the clear explanation and patch!

comment:3 Changed 13 years ago by

Something I just noticed there is a bcfg2-server.init file that seems to use more "typical" redhat init.d script

It appears the rpm SPEC file uses the debian scripts when it builds the RPM, there are other places in the SPEC file that are checking for redhat, but not in the %install section. I'm not sure if it is intentional or not, or if this redhat/scripts/bcfg2-server.init is even current (its older and doesn't seem to pass options to the bcfg2-server daemon), but I thought I would note this in case someone else needs it in the future.

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.