2

This is a minor error that I can't figure out. When I enter the pidof command to shut down a process, the command line just executes pidof and goes to the next line and nothing happens. No error message no nothing.

Example:

pidof supervisord
Avada Kedavra
  • 8,523
  • 5
  • 32
  • 48
Lucas Ou-Yang
  • 5,505
  • 13
  • 43
  • 62

3 Answers3

3

That's the expected behavior of pidof when it doesn't find any processes by that name.

Also, it doesn't kill the process, just returns the process ID of it. You want to use "killall" to actually kill a process, or a combination of "pidof" to get the PID and "kill" to kill that PID.

killall supervisord

Or

kill $(pidof supervisord)
PherricOxide
  • 15,493
  • 3
  • 28
  • 41
  • But supervisord is in the directory where the command is being called, how should I go about debugging this? – Lucas Ou-Yang Sep 25 '12 at 23:29
  • It looks like supervisord is a process that just restarts pythons scripts/binaries if they crash. You're probably wanting to stop a script that was started by supervisord, and not supervisord itself? We need more information on what you're trying to do. – PherricOxide Sep 25 '12 at 23:34
  • 1
    @Lucas - pidof, kill, and killall work on running processes, not on files. It doesn't matter what directory supervisord is in or what directory you're in when you run one of those three commands. – Stephen P Sep 25 '12 at 23:35
  • I'm just trying to differentiate between processes and files like Stephen said. So supervisord is a file that starts a process, how can I find the name of the process so my pidof works on it? – Lucas Ou-Yang Sep 25 '12 at 23:37
  • supervisord's entire purpose is to launch other applications, so it could be configured to launch anything in your case. If supervisord is running still, you could get the child processes something like "pstree $(pidof supervisord)". However, I assume that you already killed supervisord, so there's really no way I know of to figure out what it launched (other than looking in the supervisord configuration). – PherricOxide Sep 25 '12 at 23:48
  • You could take a look at this, http://countergram.com/pylons-supervisor Maybe take a look at /etc/supervisord.conf to see what it's launching, or try to run the command "supervisorctl status". – PherricOxide Sep 25 '12 at 23:50
1

Pidof looks at the process list in the following way

root       526  0.9  0.0  56556 11788 ?        Ss   Sep19  89:39 /usr/bin/python 
/usr/bin/supervisord

So,

 # pidof python  
 526
kiminoa
  • 2,649
  • 3
  • 16
  • 17
Garacio
  • 11
  • 1
1

Try

pgrep -f "supervisord"
sezanzeb
  • 816
  • 8
  • 20