ansible 如何控制 windows 后台运行 nginx?

2017-05-06 22:48:26 +08:00
 yuyuyu

我使用下面的命令启动

ansible web -m win_shell -a 'start nginx chdir=C:\\nginx-1.13.0'

结果命令执行完返回后,windows 上没有 nginx 的进程,但 nginx 有生成 logs,感觉是刚启动完随着 ansible 的返回又被杀掉了 我看了 ansible 官方文档 http://docs.ansible.com/ansible/win_shell_module.html 下面有说“ WinRM will not return from a command execution until all child processes created have exited. Thus, it is not possible to use win_shell to spawn long-running child or background processes. Consider creating a Windows service for managing background processes.” 但我确实要启动 nginx 并且不希望用服务的方式,不然没办法 -s reload

也尝试过运行一个 cmd 然后里面写 start nginx,还有自己写一个小程序去运行 nginx,都不行,要么是没有 nginx 进程,要么是 nginx 启动成功但 ansible 一直挂起没有返回

5096 次点击
所在节点    Ansible
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/359619

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX