V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
littlepython
V2EX  ›  Python

windows server 怎么设置守护进程

  •  
  •   littlepython · 2019-08-15 13:57:04 +08:00 · 4249 次点击
    这是一个创建于 1708 天前的主题,其中的信息可能已经有所发展或是发生改变。
    有几个 python 脚本在 windows server 下运行 ,有没有什么办法可以给它刷个守护
    14 条回复    2019-08-15 16:36:00 +08:00
    soulzz
        1
    soulzz  
       2019-08-15 14:01:24 +08:00   ❤️ 1
    winsw
    wqawd520
        2
    wqawd520  
       2019-08-15 14:02:20 +08:00   ❤️ 1
    百度 windows 服务,就行了
    jay4497
        3
    jay4497  
       2019-08-15 14:08:11 +08:00   ❤️ 1
    作为 Windows 服务么,可以看看 NSSM。
    hihipp
        4
    hihipp  
       2019-08-15 14:11:11 +08:00   ❤️ 1
    目前最优解应该就是 3 楼说的 NSSM。
    lihongjie0209
        5
    lihongjie0209  
       2019-08-15 14:18:16 +08:00   ❤️ 1
    NSSM
    littlepython
        6
    littlepython  
    OP
       2019-08-15 14:20:22 +08:00
    刚刚试了一下 nssm 这个要交 python 脚本打包成 exe 文件吗 @hihipp
    littlepython
        7
    littlepython  
    OP
       2019-08-15 14:21:41 +08:00
    @soulzz 这个也需要打包成 exe ?
    arrow8899
        8
    arrow8899  
       2019-08-15 14:38:55 +08:00   ❤️ 1
    https://stackoverflow.com/questions/32404/how-do-you-run-a-python-script-as-a-service-in-windows
    这上面有几种方法,你试下
    sc create PythonApp binPath= "C:\Python34\Python.exe --C:\tmp\pythonscript.py"
    soulzz
        9
    soulzz  
       2019-08-15 14:40:31 +08:00   ❤️ 1
    @littlepython 不需要 这个是通过别人打包好的应用注册为服务再调用你的指令
    littlepython
        10
    littlepython  
    OP
       2019-08-15 15:00:12 +08:00
    @soulzz 你说的这个方法成功了 有一点没试过 多个脚本是不是只用设置在一个 xml 里面写就可以
    soulzz
        11
    soulzz  
       2019-08-15 15:03:38 +08:00   ❤️ 1
    多个脚本建议放在不同文件夹下取不同名字避免混淆
    littlepython
        12
    littlepython  
    OP
       2019-08-15 16:05:49 +08:00
    @jay4497 nssm 设置成功了 yeah
    littlepython
        13
    littlepython  
    OP
       2019-08-15 16:06:49 +08:00
    @arrow8899 谢谢 这个里面的 nssm 里面设置成功 那个命令的出了些问题
    wuwukai007
        14
    wuwukai007  
       2019-08-15 16:36:00 +08:00
    alwaysup
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1282 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:31 · PVG 07:31 · LAX 16:31 · JFK 19:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.