6

これは繰り返される質問のように思えるかもしれませんが、そうではありません。start-stop-daemonPIDファイルを作成しない記事をいくつか見つけました。しかし、私の場合は、すでに PID ファイルを作成しています。サーバーで次のコマンドを実行して、Nginx を起動します。

/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ファイルに書き込みません。--make-pidfileオプションを使用しようとしましたが、start-stop-daemon間違った pid をファイルに書き込みます。

4

1 に答える 1

7

--make-pidfileオプションは必須です。start-stop-daemon「間違ったpid」と書いている理由は、nginxフォークです。これはstart-stop-daemonmanページに記載されています:

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

(分岐の部分を参照してください。)

nginx独自の pid ファイルを作成するなど、別のソリューションを使用する必要があります。

于 2012-12-28T03:15:02.337 に答える