为什么 puppet 无法启动 Dropbox 守护进程?
我在 Ubuntu 11.10 上使用 Dropbox 命令行实用程序/守护进程,但它无法正常工作与木偶。
我可以成功地手动控制 dropbox:
$ sudo /etc/init.d/dropbox [status/start/stop/status]
但是,当我配置 Puppet 以确保 dropbox 始终运行时,它会失败并显示以下日志消息:
(/Stage[main]/Dropbox::Service/Service[dropbox]/ensure) change from stopped to running failed: Could not start Service[dropbox]: Execution of '/etc/init.d/dropbox start' returned 1: at /etc/puppet/modules/dropbox/manifests/init.pp:8
这是我的 puppet 清单文件:
class dropbox {
include dropbox::service
}
class dropbox::service {
service { "dropbox":
ensure => running,
}
}
上面的错误消息似乎还暗示 dropbox“status”命令未运行不适用于 Puppet,因为即使 Dropbox 已经在运行,我也会收到相同的错误消息(“无法启动”)。
有什么想法吗?
I'm using the Dropbox command-line utility/daemon on Ubuntu 11.10 but it's not working with Puppet.
I can successfully control dropbox manually:
$ sudo /etc/init.d/dropbox [status/start/stop/status]
However when I configure Puppet to ensure that dropbox is always running, it fails with this log message:
(/Stage[main]/Dropbox::Service/Service[dropbox]/ensure) change from stopped to running failed: Could not start Service[dropbox]: Execution of '/etc/init.d/dropbox start' returned 1: at /etc/puppet/modules/dropbox/manifests/init.pp:8
Here is my puppet manifest file:
class dropbox {
include dropbox::service
}
class dropbox::service {
service { "dropbox":
ensure => running,
}
}
The above error message also seems to imply that the dropbox "status" command isn't working for Puppet because I get the same error message ("Could not start") even when Dropbox is already running.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
2.7 之前的 Puppet 版本默认不使用 /etc/init.d/service status 命令。他们在进程表中查找进程名称,因此如果守护进程进程名称与服务名称不同,这些行为会给您带来如下错误:
在每次执行木偶代理时。您应该检查该服务是否具有工作状态命令:
然后告诉木偶使用它而不是它自己的(<2.7)机制 - 在服务定义中放置“hasstatus => true”。
Puppet versions before 2.7 by default don't use /etc/init.d/service status command. They look for process name in process table, so if the daemon process name is different from service name those behaviour will give you errors like:
on every execution of puppet agent. You should check if that service has working status command:
Then tell the puppet to use it instead of it's own (<2.7) mechanisms - put "hasstatus => true," in service definition.
除此之外,由于 Google 很流行“puppet 无法启动服务”,我在 CentOS 上也遇到了类似的问题。事实证明,我的问题是由于 sudo:我
的 sudoers 文件中的。将其更改为
“修复了问题”,并允许我的服务脚本(使用 sudo 运行守护程序)通过 puppet 工作。
希望这对未来的 Google 员工有所帮助!
To add to this as it's a popular Google hit for "puppet can't start service", I had a similar problem on CentOS. Turns out that my problem was due to sudo: I had
in my sudoers file. Changing this to
Fixed the problem, and allowed my service script (which was using sudo to run the daemon) to work via puppet.
Hope this helps future Googlers!