V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Ansible
Ansible Documentation
yuyuyu
V2EX  ›  Ansible

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

  •  
  •   yuyuyu · 2017-05-06 22:48:26 +08:00 · 5057 次点击
    这是一个创建于 2517 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我使用下面的命令启动

    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 一直挂起没有返回

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3348 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 13:37 · PVG 21:37 · LAX 06:37 · JFK 09:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.