gpt4 book ai didi

python - 结构重新启动我的 supervisord 服务终止服务

转载 作者:太空宇宙 更新时间:2023-11-03 15:19:16 26 4
gpt4 key购买 nike

我有一个使用 supervisord 运行的 tornado 网络应用程序。我从 ssh 手动启动、停止和重新启动 Supervisord 服务,它工作正常。我正在使用本地机器上的结构来执行以下操作:

  1. 运行单元测试
  2. 提交/推送到我的 git 服务器
  3. 从开发服务器拉取更改
  4. 重新启动 Supervisord 服务以更新应用

我在运行 fabfile 时没有收到任何错误,但我的服务器在运行后出现故障。以下是我的 fabfile 代码:

from fabric.api import *
from fabric.context_managers import settings

def prepare_deploy():
local('py.test')
local('git add .')
x = raw_input('what would you like your commit message to be? ')
local('git diff --quiet --exit-code --cached || git commit -m "' + x + '"')
local('git push origin master')

def dev():
prepare_deploy()
x = raw_input('Please enter the location of your keyFile for the dev server ')
if x == '':
key = 'key_file'
else:
key = x
with settings(
host_string='dev_server_name',
user='user_name',
Key_filename=key,
use_ssh_config = True):
code_dir='~/path/to/code/'
with cd(code_dir):
run("git pull origin master")
run("sudo python setup.py install")
run("sudo service supervisord restart")

完成此操作后,我的 Web 应用程序将关闭。关于为什么会发生这种情况的任何想法?

最佳答案

Supervisor 是一个管理服务的工具,不需要重启它就可以重启它控制的东西。

它带有一个命令行工具来管理进程,supervisorctl .您可以将其用作 CLI 界面或交互式 shell。

如果要重启服务supervisorctl restart <service name> (具有适当的权限,所以可能使用 sudo 做到这一点。如果您更改了服务的配置,请使用 supervisorctl update 重新启动受影响的进程。这样您就可以使用主管的日志文件,以防您的进程未启动。

关于python - 结构重新启动我的 supervisord 服务终止服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17732042/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com