Supervisord - 启动一个backgroup python脚本

时间:2021-03-15 14:56:57

I create bash to run python script start_queue.sh

我创建bash来运行python脚本start_queue.sh

content of start_queue.sh

start_queue.sh的内容

python /tmp/my_python_script.py & 

It's work when I run it in terminal. But I want to manage it using supervisord since I have few django website already manage by supervisord.

当我在终端运行它时,它的工作。但是我想用supervisord来管理它,因为我已经有很多django网站已经由supervisord管理了。

But I just get the error when start

但我刚开始时就得到了错误

supervisor: couldn't exec /tmp/start_queue.sh: ENOEXEC
supervisor: child process was not spawned

This is how i config in supervisord

这就是我在supervisord中的配置方式

[group:scriptgroup]
programs=script_1

[program:script_1]
command=/tmp/start_queue.sh
directory=/tmp/
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/x.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=50
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
loglevel=info

It's possible to manage a backgroup process by supervisord, What did i wrong here. Please help.

可以通过supervisord管理一个backgroup流程,这里我错了什么。请帮忙。

2 个解决方案

#1


18  

Add #!/bin/sh at the beginning of script.

在脚本开头添加#!/ bin / sh。

#2


0  

You need to execute your shell script spawned. Spawn means when you kill it, it doesn't kill unless a set of cicumstances to be.

您需要执行生成的shell脚本。 Spawn意味着当你杀死它时,它不会被杀死,除非有一系列的咒语。

notes: supervisor is a python module that control proocessing. For your answer , please visit : http://stackful-dev.com/simplify-unix-process-herding-with-supervisor.html

注意:supervisor是一个控制处理的python模块。如需答案,请访问:http://stackful-dev.com/simplify-unix-process-herding-with-supervisor.html

#1


18  

Add #!/bin/sh at the beginning of script.

在脚本开头添加#!/ bin / sh。

#2


0  

You need to execute your shell script spawned. Spawn means when you kill it, it doesn't kill unless a set of cicumstances to be.

您需要执行生成的shell脚本。 Spawn意味着当你杀死它时,它不会被杀死,除非有一系列的咒语。

notes: supervisor is a python module that control proocessing. For your answer , please visit : http://stackful-dev.com/simplify-unix-process-herding-with-supervisor.html

注意:supervisor是一个控制处理的python模块。如需答案,请访问:http://stackful-dev.com/simplify-unix-process-herding-with-supervisor.html