停止监督:关闭

时间:2013-01-23 12:35:22

标签: supervisord

我厌倦了开始上司,但得到了错误。有人可以帮忙吗?感谢

/etc/init.d/supervisord file。

SUPERVISORD=/usr/local/bin/supervisord
SUPERVISORCTL=/usr/local/bin/supervisorctl
case $1 in
start)
        echo -n "Starting supervisord: "
        $SUPERVISORD
        echo
        ;;
stop)
        echo -n "Stopping supervisord: "
        $SUPERVISORCTL shutdown
        echo
        ;;
restart)
        echo -n "Stopping supervisord: "
        $SUPERVISORCTL shutdown
        echo
        echo -n "Starting supervisord: "
        $SUPERVISORD
        echo
        ;;
esac

然后运行这些

sudo chmod +x /etc/init.d/supervisord
sudo update-rc.d supervisord defaults
sudo /etc/init.d/supervisord start

得到这个:

Stopping supervisord: Shut down

Starting supervisord: /usr/local/lib/python2.7/dist-packages/supervisor/options.py:286: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /usr/local/bin/supervisord -h

配置文件(位于/etc/supervisord.conf):

[unix_http_server]
file=/tmp/supervisor.sock; (the path to the socket file)

[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10          ; (num of main logfile rotation backups;default 10)
loglevel=info               ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false              ; (start in foreground if true;default false)
minfds=1024                 ; (min. avail startup file descriptors;default 1024)
minprocs=200                ; (min. avail process descriptors;default 200)

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock; use a unix:// URL  for a unix socket

[program:myproject]
command=/home/richard/envs/myproject_stage/bin/python /home/richard/webapps/myproject/manage.py run_gunicorn -b 127.0.0.1:8002 --log-file=/tmp/myproject_stage_gunicorn.log
directory=/home/richard/webapps/myproject/
user=www-data
autostart=true
autorestart=true
stdout_logfile=/tmp/myproject_stage_supervisord.log
redirect_stderr=true

7 个答案:

答案 0 :(得分:47)

sudo unlink /tmp/supervisor.sock

.sock 文件在/etc/supervisord.conf的[ unix_http_server ]的文件配置值中定义(默认为/tmp/supervisor.sock)。

答案 1 :(得分:45)

首先,在您的控制台或终端上输入

ps -ef | grep supervisord

你会得到一些像这些

的监督
  

root 2641 12938 0 04:52 pts / 1 00:00:00 grep --color = auto supervisord

     

root 29646 1 0 04:45? 00:00:00 / usr / bin / python / usr / local / bin / supervisord

如果你得到这样的输出,你的pid是第二个。然后,如果你想关闭你的主管,你可以这样做

kill -s SIGTERM 29646
希望它有所帮助。参考:http://supervisord.org/running.html#signals

答案 2 :(得分:13)

尝试运行这些命令

sudo unlink /run/supervisor.sock

sudo /etc/init.d/supervisor start

答案 3 :(得分:9)

$ ps aux | grep supervisor
alexamil         54253   0.0  0.0  2506960   6440   ??  Ss   10:09PM   0:00.26 /usr/bin/python /usr/local/bin/supervisord -c supervisord.conf

所以我们可以使用:

$ pkill -f supervisord  # kill it

答案 4 :(得分:4)

从版本3.0a11开始,您可以执行以下操作:

sudo kill -s SIGTERM $(sudo supervisorctl pid)supervisorctl pid函数的后面跳跃。

答案 5 :(得分:3)

这对我有用。在终端中运行以下命令(对于Linux计算机)

要检查进程是否正在运行:

sudo systemctl status supervisor

要停止该过程:

sudo systemctl stop supervisor

答案 6 :(得分:2)

已有许多答案可供选择。我将提出一个更清洁的方式来关闭supervisord。

默认情况下,supervisord在supervisord.conf文件所在的目录中创建一个名为 supervisord.pid 的文件。该文件包含supervisord守护进程的pid。从文件中读取pid并终止supervisord进程。

但是,您可以配置应在何处创建supervisord.pid文件。请参阅此链接进行配置,http://supervisord.org/configuration.html