Home  >  Q&A  >  body text

python - securecrt关闭时候如何能保持服务器上的两个服务持续运行下去?

迷茫迷茫2765 days ago476

reply all(5)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 09:25:22

    It is recommended to use tmux (Linux terminal reuse software), the solution is as follows: (CentOS machine)

    yum install tmux -y //安装软件
    tmux //启动新终端
    cd xxx //cd到你的脚本目录
    python server.py//

    The script is already running at this time. Even if the shell terminal is closed, the program is still running, because the direct terminal that starts the program is tmux, not your securecrt.
    If you want to check the process status, reopen securecrt and execute

    tmux attach

    tmux detailed documentation
    documentation

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 09:25:22

    One process management supervisord is all it takes

    reply
    0
  • PHPz

    PHPz2017-04-18 09:25:22

    $nohup your_service &
    Convert to background operation, ignore stderr, stdout is transferred to nohup.out. It will continue even if you exit the terminal.

    Or search how to register a linux service so that it can be managed with
    $service xxx start

    reply
    0
  • 黄舟

    黄舟2017-04-18 09:25:22

    The methods mentioned above can be used. I'm talking about one that uses screen. For example:

    screen -S xyz (Choose a memorable name)
    xxxx (your command)
    ctrl+a+d
    Then just exit.
    After logging in next time, execute:

    screen -r xyz
    You can return to the last interface you exited

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:25:22

    System V initsupervisord未来都是systemd dishes

    ^_^

    reply
    0
  • Cancelreply