2012-09-17 2 views
6

이것은 반복되는 질문 인 것처럼 보일 수 있지만 그렇지 않습니다. start-stop-daemon이 PID 파일을 만들지 않는 기사를 발견했습니다. 하지만 제 경우에는 이미 PID 파일을 만들었습니다.파일이있는 경우에도 start-stop-daemon은 nginx.pid 파일에 기록하지 않습니다.

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

는 PID 파일이 이미 존재하지만 여전히 start-stop-daemon은 파일에 기록하지 않습니다 내가 Nginx에 시작하는 내 서버에서이 명령을 실행합니다. 심지어 --make-pidfile 옵션을 사용하려고 시도했지만 start-stop-daemon은 잘못된 pid를 파일에 기록합니다.

답변

7

--make-pidfile 옵션이 필요합니다. 그 이유는 start-stop-daemon이 "wrong pid"라고 쓰는 이유는 nginx 포크입니다. 이것은 start-stop-daemon man 페이지에 기록됩니다 :

-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. 

가 (분기 다시 부분을 참조하십시오.)

당신은 자신의 PID 파일을 만들 nginx을 받고 같은 다른 솔루션을 사용해야합니다.

+0

'nginx'가 자체 파일을 생성하게됩니다. 이것은 http://wiki.nginx.org/CoreModule#pid에 설명되어 있습니다. 기본적으로 nginx.conf 파일에 pid 지시문을 추가하면됩니다. – Such

관련 문제