首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启动-停止-守护程序不写入nginx.pid文件,即使该文件存在

启动-停止-守护程序不写入nginx.pid文件,即使该文件存在
EN

Stack Overflow用户
提问于 2012-09-17 19:22:37
回答 1查看 4.8K关注 0票数 6

这似乎是一个重复的问题,但事实并非如此。我在上面找到了一些关于start-stop-daemon不创建PID文件的文章。但在我的例子中,我已经创建了PID文件。我在我的服务器上执行以下命令来启动Nginx:

代码语言:javascript
复制
/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写入文件。

EN

回答 1

Stack Overflow用户

发布于 2012-12-28 11:15:02

--make-pidfile选项是必需的。start-stop-daemon写入“错误的pid”的原因是nginx派生的。start-stop-daemon手册页中记录了这一点:

代码语言:javascript
复制
   -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文件。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12458182

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档