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?
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.
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.
-
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.– JohnFeb 14, 2012 at 7:24
-
It wasn't clear how you were getting the PID and writing out the file. I'm following adaptr's thinking.– cjcFeb 14, 2012 at 10:49