Ticket #864 (closed defect: fixed)
service bcfg2-server status returns incorrect results
Reported by: | https://www.google.com/accounts/o8/id?id=AItOawlo86Mt9tqt2k06humTEpjOdekfWJoTv4M | Owned by: | solj |
---|---|---|---|
Priority: | major | Milestone: | Bcfg2 1.1.0 Release |
Component: | bcfg2-server | Version: | 1.0 |
Keywords: | Cc: | [email protected]… |
Description
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 bcfg2-server-1.0.1-1 [[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 74c74 < PID=$(pidof -x $BINARY -o %PPID) --- > PID=$(pidof -x $BINARY) [[email protected] ~] service bcfg2-server status bcfg2-server is not running [FAILED]
Attachments
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 https://www.google.com/accounts/o8/id?id=AItOawlo86Mt9tqt2k06humTEpjOdekfWJoTv4M
Something I just noticed there is a bcfg2-server.init file that seems to use more "typical" redhat init.d script
http://trac.mcs.anl.gov/projects/bcfg2/browser/trunk/bcfg2/redhat/scripts/bcfg2-server.init
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.