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

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

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

    腾讯云最新优惠活动来了:云产品限时1折,云服务器低至88元/年 ,点击这里立即抢购:9i0i.cn/qcloud,更有2860元代金券免费领取,付款直接抵现金用,点击这里立即领取:9i0i.cn/qcloudquan

    (福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

    我使用下面的命令启动

    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   ·   我们的愿景   ·   实用小工具   ·   1991 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 01:26 · PVG 09:26 · LAX 18:26 · JFK 21:26
    Developed with CodeLauncher
    ? Do have faith in what you're doing.


    http://www.vxiaotou.com