Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have sphinx_search installed and a pid_file associated with it. When I start the process from the shell, using the command "searchd", then the process gets the PID mentioned in the pid_file. Now, I have written a bash script which checks if process is running, if not start the process using the "searchd" command. But, the process does not get the PID mentioned in the pid_file. Why so?

share|improve this question
add comment

2 Answers

Why would any process "get a PID" mentioned anywhere ?

Process IDs are assigned by the kernel at the moment a process is forked; nothing else has any influence on what that PID actually is.

share|improve this answer
add comment

Do you have a pid_file directive in the searchd block of your sphinx configuration file?

Is the shell script disobeying the searchd directive, or are you trying to derive the pid in the shell script?

Also, instead of writing your own shell script to keep sphinx up, you can look at something like monit or Upstart (on Ubuntu) to do that. It'll be a more "standard" solution, rather than something homebrew.

share|improve this answer
    
ok. What do you mean by "Is the shell script disobeying the searchd directive". Eventually, I got the bash script working and added to the cron. –  John Feb 14 '12 at 7:24
    
It wasn't clear how you were getting the PID and writing out the file. I'm following adaptr's thinking. –  cjc Feb 14 '12 at 10:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.