2012-09-17 8 views
6

Esto puede parecer una pregunta repetida pero no lo es. Encontré algunos artículos donde start-stop-daemon no crea un archivo PID. Pero en mi caso, ya he creado el archivo PID. Ejecuto este comando en mi servidor para iniciar Nginx:start-stop-daemon no escribe en el archivo nginx.pid aunque el archivo esté presente

/mnt/nginx/logs/nginx.pid 
start-stop-daemon --start --quiet --pidfile /mnt/nginx/logs/nginx.pid --exec /usr/local/sbin/nginx 

archivo El PID ya está presente pero aún así el start-stop-daemon no escribe en el archivo. Incluso intenté usar la opción --make-pidfile, pero luego el start-stop-daemon escribe el pid incorrecto en el archivo.

Respuesta

7

Se requiere la opción --make-pidfile. El motivo start-stop-daemon escribe "pid incorrecto" es que nginx se bifurca. Esto se indica en la página start-stop-daemon hombre:

-m, --make-pidfile 
      Used when starting a program that does not create its own pid 
      file. This option will make start-stop-daemon create the file 
      referenced with --pidfile and place the pid into it just before 
      executing the process. Note, the file will not be removed when 
      stopping the program. NOTE: This feature may not work in all 
      cases. Most notably when the program being executed forks from 
      its main process. Because of this, it is usually only useful 
      when combined with the --background option. 

(ver la parte nueva que se bifurcan.)

Usted tendrá que utilizar una solución diferente, tales como conseguir nginx para crear su propio archivo pid.

+0

obteniendo 'nginx' para crear su propio archivo: aquí se describe: http://wiki.nginx.org/CoreModule#pid. Básicamente, solo tiene que agregar la directiva pid a su archivo nginx.conf. – Such

Cuestiones relacionadas