puppet-server-2.7.19-1.el5是从傀儡实验室安装的。puppetmaster已成功启动,但它没有创建pid文件。当停止时,这是[ FAILED ]消息的原因:
/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用户的身份运行的:
ps -ef | grep [p]uppet
puppet 23418 1 0 18:13 ? 00:00:00 /usr/bin/ruby /usr/sbin/puppetmasterd/var/run/puppet/文件夹的所有者是puppet
# ls -ld /var/run/puppet/
drwxr-xr-x 2 puppet puppet 4096 Sep 17 18:46 /var/run/puppet/发布于 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中的值。
发布于 2014-01-08 01:30:04
所以,在我看来,这里有几种可能性:
- 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]}`
$PUPPETMASTER (或者更确切地说,是它背后的程序)可能会将自己去守护,如果是这样的话,可以负责创建自己的.pid文件。过程管理工具马戏团就是这样工作的。它可能是配置文件中的一个选项,或者是由$PUPPETMASTER表示的程序的选项。- 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.
很好的狩猎!
https://stackoverflow.com/questions/12768419
复制相似问题