Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I keep my sphinx pid in /var/run/sphinx/ but every time I hard reboot the directory /var/run/sphinx disappears and sphinx fails to start. Is there a way to make that directory stick or have it automatically created? How do people usually handle this situation? I use Ubuntu Hardy

share|improve this question
Can you give us the output of mount? – reconbot Oct 15 '09 at 15:05

That directory is ephemeral by design. If its contents stuck around across boots, all sorts of ugly effects could occur, as control scripts of various sorts look in there to see what processes they should be signaling. On recent system, this temporary nature is enforced by mounting /var/run as tmpfs, while older systems just deleted everything in the directory at startup.

Therefore, you need to configure Sphinx or its startup script to create that directory, or just write the PID file in /var/run directly.

share|improve this answer
+1 for description of /var/run. But note that he doesn't want the PID file to be persistent across a reboot; just the sphinx directory. – Steve Folly Oct 15 '09 at 15:30

You have two chances at least:

  • change your init script to do a mkdir -p /var/run/sphinx/


  • set pid_file = /var/run/ in /etc/sphinx.conf

I'm for the second one.

share|improve this answer
And of course this means the startup script must run as root to be able to write directly to or create a directory in /var/run. Which is annoying... – Eloff Oct 26 '12 at 17:40
I chose the second solution as well. It looks like there is precedence for this (cron, ssh, atd, syslog). – BillMan May 30 '13 at 13:39

Your Answer


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