首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >傀儡init脚本不创建pid文件?

傀儡init脚本不创建pid文件?
EN

Stack Overflow用户
提问于 2012-10-07 11:28:47
回答 2查看 5.4K关注 0票数 5
  • CentOS版本5.4 (最终)
  • puppet-server-2.7.19-1.el5是从傀儡实验室安装的。

puppetmaster已成功启动,但它没有创建pid文件。当停止时,这是[ FAILED ]消息的原因:

代码语言:javascript
复制
/etc/init.d/puppetmaster stop
Stopping puppetmaster:                                     [FAILED]

init脚本:http://fpaste.org/nsfI/

/etc/rc.d/init.d/functions库:http://fpaste.org/ox5Q/

这就是我在调试模式下运行时得到的结果:http://fpaste.org/DkoS/

我知道如何在启动后手动将pid发送到文件,但是为什么daemon函数的--pidfile不能工作?

daemon $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]} --pidfile=/var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid

当然,木偶主人是以puppet用户的身份运行的:

代码语言:javascript
复制
ps -ef | grep [p]uppet
puppet   23418     1  0 18:13 ?        00:00:00 /usr/bin/ruby /usr/sbin/puppetmasterd

/var/run/puppet/文件夹的所有者是puppet

代码语言:javascript
复制
# ls -ld /var/run/puppet/
drwxr-xr-x 2 puppet puppet 4096 Sep 17 18:46 /var/run/puppet/
EN

回答 2

Stack Overflow用户

发布于 2012-11-23 18:04:51

创建pidfile取决于控制程序(在本例中是puppetmasterd),而不是daemon()函数;daemon()依赖于此。

确认puppetmasterd在其中创建它的pidfile (可以是/var/run/puppet.pid/var/lib/puppet/run/master.pid等)。要找出答案,请检查puppetmasterd的内容(如果是脚本),或者杀死puppetmasterd然后删除strace -f puppetmasterd 2>&1 | grep '\.pid'

相应地修改pidfile/etc/init.d/puppetmaster中的值。

票数 2
EN

Stack Overflow用户

发布于 2014-01-08 01:30:04

所以,在我看来,这里有几种可能性:

  1. 如果您试图使用守护进程命令的-pidfile选项,我相信您有语法问题。
代码语言:javascript
复制
- Red Hat's daemon command has the following (unhelpful) signature: `Usage: daemon [+/-nicelevel] {program}`.  **What isn't altogether clear is that anything that you include after the program location is treated as an option passed to the program, not to the daemon function call.**
- So, in your case you are passing the `--pidfile` argument to `$PUPPETMASTER` itself as opposed to `daemon()`.  You could remedy this by using the following: `daemon --pidfile=/var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]}` 

  1. 这里的第二个选项是$PUPPETMASTER (或者更确切地说,是它背后的程序)可能会将自己去守护,如果是这样的话,可以负责创建自己的.pid文件。过程管理工具马戏团就是这样工作的。它可能是配置文件中的一个选项,或者是由$PUPPETMASTER表示的程序的选项。
代码语言:javascript
复制
- I'm not a Puppet user, so I won't be able to help you with the specifics here.  But I would look into the [Puppet labs documentation](http://docs.puppetlabs.com/) to find out more about this option.
- It is important to note if $PUPPETMASTER is daemonizing itself, then the `--pidfile` argument being passed to `daemon()` will have no effect.

很好的狩猎!

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

https://stackoverflow.com/questions/12768419

复制
相关文章

相似问题

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