8

I'm trying to kill Sphinx on my server so that I can restart it. I tried using this command to find the PID:

ps ax | grep "searchd"

Which printed out this:

 1483 ?        S     00:00 /usr/local/bin/searchd --config /path/to/sphinx.conf
 1484 ?        Sl    20:51 /usr/local/bin/searchd --config /path/to/sphinx.conf
 1523 ?        S      0:00 /usr/local/bin/searchd --config /path/to/another/sphinx.conf
 1524 ?        Sl    20:35 /usr/local/bin/searchd --config /path/to/another/sphinx.conf
14174 pts/0    S+     0:00 grep searchd

I'm confused why there are duplicate entries and can't figure out what the S or Sl columns mean, but I tried this:

kill pid 1483
kill pid 1484

But that outputted this error:

-bash: kill: pid: arguments must be process or job IDs

When I list the processes again, it looks like it did kill the processes (I ran the kill command for the first two), but the error makes me wonder what I did wrong?

Nate
  • 26,164
  • 34
  • 130
  • 214
  • 1
    Off-topic; belongs on [su] – Jim Garrison Aug 14 '14 at 21:55
  • 3
    They might be zombie processes. Don't know.. – konsolebox Aug 14 '14 at 22:03
  • See http://en.wikipedia.org/wiki/Zombie_process – konsolebox Aug 14 '14 at 22:04
  • 1
    My theory is that the kernel didn't validate them as valid process ids when `kill` tried to send message them yet the kernel recognizing that they were zombies, killed them which doesn't become apparent to `kill` who just reports back that they didn't exist. Just a theory :) – konsolebox Aug 14 '14 at 22:05
  • 1
    Why are you not using `searchd --stop` ? – barryhunter Aug 15 '14 at 09:42
  • @barryhunter Two reasons: 1) I didn't know it existed :-) and 2) it looks like that stops all `searchd` processes, as opposed to just for one website? – Nate Aug 15 '14 at 14:07
  • 1
    It only stops the approriate one(s), if you have multiple 'instances' you should pass the config file too `searchd --stop --config /path/to/sphinx.conf` - it uses the pid file (from the config) to identify the right master process. The child processes are automatically shutdown by the master. – barryhunter Aug 15 '14 at 14:54

1 Answers1

7

It's

kill 1483
kill 1484

When you entered

kill pid 1483

What you said in effect was

Please kill the processes with number 'pid' and 1483.

The reference to pid in the message

-bash: kill: pid: arguments must be process or job IDs

is telling you the string 'pid' was not a valid process ID

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190