Bug 1262857 - 'pidof -m' option gives inavlid option error
'pidof -m' option gives inavlid option error
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: sysvinit (Show other bugs)
6.7
x86_64 Linux
unspecified Severity high
: rc
: ---
Assigned To: Lukáš Nykrýn
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-14 09:38 EDT by Soumya
Modified: 2015-09-16 07:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-09-16 07:37:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
CentOS 9321 None None None Never

  None (edit)
Description Soumya 2015-09-14 09:38:11 EDT
With package initscripts-9.03.49-1.el6.centos.x86_64, there is an addition of -m option in function __pids_pidof, in file /etc/rc.d/init.d/functions

-------------------------
183 # Output PIDs of matching processes, found using pidof
184 __pids_pidof() {
185 pidof -c -m -o $$ -o $PPID -o %PPID -x "$1" || \
186 pidof -c -m -o $$ -o $PPID -o %PPID -x "${1##*/}"
187 }
-------------------------

But pidof command isn't recognizing the -m option, though the rpm changelog shows -m option is added.

------------------------
$ pidof -c -m -o 41849 -o 41842 -o %PPID -x SRVC
pidof: invalid options on command line!

$ rpm -qf /sbin/pidof
sysvinit-tools-2.87-6.dsf.el6.x86_64

$ rpm -q --changelog sysvinit-tools-2.87-6.dsf.el6.x86_64 | head -4
* Thu Feb 26 2015 Lukáš Nykrýn <lnykryn@redhat.com> - 2.87-6.dsf
- pidof: add -m option (#883857)
- count with deleted binaries (#760251)
------------------------

Because pidof command gives invalid option error, its not possible to cleanly restart a service [leading service instability].
Comment 2 Lukáš Nykrýn 2015-09-15 09:16:59 EDT
Hmm I can't reproduce the issue:

[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[1] 1428
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[2] 1437
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[3] 1448
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[4] 1461
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[5] 1471
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[6] 1481
[lnykryn@notas src(rhel-6.7)]$ sleep 30 &
[7] 1490
[lnykryn@notas src(rhel-6.7)]$ ./pidof -c -m -o 1428 -o %PPID -x sleep
[lnykryn@notas src(rhel-6.7)]$
Comment 3 Lukáš Nykrýn 2015-09-15 09:49:46 EDT
and one more test on rhel6 machine:
[root@rhel6 init.d]# rpm -q initscripts sysvinit-tools
initscripts-9.03.49-1.el6.x86_64
sysvinit-tools-2.87-6.dsf.el6.x86_64
[root@rhel6 init.d]# . /etc/init.d/functions 
[root@rhel6 init.d]# sleep 600 &
[3] 1412
[root@rhel6 init.d]# sleep 600 &
[4] 1413
[root@rhel6 init.d]# sleep 600 &
[5] 1414
[root@rhel6 init.d]# sleep 600 &
[6] 1415
[root@rhel6 init.d]# set -x
++ printf '\033]0;%s@%s:%s\007' root rhel6 /etc/init.d
[root@rhel6 init.d]# __pids_pidof sleep
+ __pids_pidof sleep
+ pidof -c -m -o 1379 -o 1375 -o %PPID -x sleep
1415 1414 1413 1412 1405 1404
++ printf '\033]0;%s@%s:%s\007' root rhel6 /etc/init.d
Comment 4 Soumya 2015-09-16 07:27:13 EDT
Ohh, I think I got the issue.. So I installed virtuozzo on top of centos 6.7.. which changes /sbin/pidof:

Earlier:

--------------
[root@ ~]# which /sbin/pidof
/sbin/pidof
[root@ ~]# rpm -qf /sbin/pidof
sysvinit-tools-2.87-6.dsf.el6.x86_64
[root@ ~]# ls -al /sbin/pidof
lrwxrwxrwx. 1 root root 8 Sep 16  2015 /sbin/pidof -> killall5
[root@ ~]# 
--------------

Post virtuozzo installation:

--------------
[root@ ~]# which /sbin/pidof
/sbin/pidof
[root@ ~]# rpm -qf /sbin/pidof
sysvinit-tools-2.87-6.dsf.el6.x86_64
[root@ ~]# ls -al /sbin/pidof
lrwxrwxrwx. 1 root root 8 Sep 16  2015 /sbin/pidof -> /sbin/vzpidof
[root@ ~]# rpm -qf /sbin/vzpidof
vz-redhat-compat-4.6.0-5.x86_64
--------------

So its an issue with the vz package.

Sorry for the trouble, and thanks for your time  Lukáš Nykrýn
Comment 5 Soumya 2015-09-16 07:30:46 EDT
CLOSED
Comment 6 Lukáš Nykrýn 2015-09-16 07:37:20 EDT
Never mind, glad to help.

Note You need to log in before you can comment on or make changes to this bug.