💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
如果是python 2.7 请使用 ~~~ pip2.7 install supervisor ~~~ ## 常用命令 ~~~ yum install supervisor sudo service supervisor stop 停止supervisor服务` sudo service supervisor start 启动supervisor服务` supervisorctl shutdown #关闭所有任务` supervisorctl stop|start program_name #启动或停止服务` supervisorctl status #查看所有任务状态` ~~~ ps aux|grep superv /usr/bin/python2 /bin/supervisord -c /etc/supervisor/supervisord.conf ## **配置supervisord****开机启动** ~~~ vim /usr/lib/systemd/system/supervisord.service ~~~ **输入以下内容** [Unit] Description=Supervisor daemon [Service] Type=forking ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf ExecStop=/usr/bin/supervisorctl shutdown ExecReload=/usr/bin/supervisorctl reload KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target ~~~ systemctl enable supervisord ~~~ **验证是否为开机启动** ~~~ systemctl is-enabled supervisord ~~~ ## 安装Supervisor ~~~ yum install python-setuptools easy_install supervisor ~~~ 如果报错可能 提示setuptools-0.6c11.tar没有安装 ~~~ 下载https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz tar zxf setuptools-0.6c11.tar.gz cd setuptools-0.6c11/ python setup.py build python setup.py install ~~~ 提示下载错误,需meld3>0.6.5 1. 1. 下载 http://dl.fedoraproject.org/pub/epel/7/x86\_64/p/python-meld3-0.6.10-1.el7.x86\_64.rpm(或者我[备份了一份](https://files.cnblogs.com/files/Hai--D/python-meld3-0.6.10-1.el7.x86_64.zip)) 2. 安装 ~~~ rpm -ivh python-meld3-0.6.10-1.el7.x86\_64.rpm ~~~   如下提示,安装完成: `Using /usr/lib64/python2.7/site-packages` `Finished processing dependencies``for``supervisor==3.3.1` ## 配置Supervisor ~~~ mkdir /etc/supervisor echo_supervisord_conf > /etc/supervisor/supervisord.conf ~~~ 修改`/etc/supervisor/supervisord.conf`文件内容 在文件结尾\[include\]节点处 把`;files = relative/directory/\*.ini` 改为 `files = conf.d/\*.conf` ### 执行 命令使配置文件生效 `supervisorctl reload` 在/etc/supervisor/下创建conf.d文件夹,及ProjectName.conf(以项目名称命名的) ~~~ [program: ProjectName] command=dotnet ProjectName.dll ; 运行程序的命令 directory=/root/Publishing/PublishOutput/ ; 命令执行的目录 autorestart=true ; 程序意外退出是否自动重启 autostart=true ; 是否自动启动 stderr_logfile=/var/log/ProjectName.err.log ; 错误日志文件 stdout_logfile=/var/log/ProjectName.out.log ; 输出日志文件 environment=ASPNETCORE_ENVIRONMENT=Production ; 进程环境变量 user=root ; 进程执行的用户身份 stopsignal=INT startsecs=1 ; 自动重启间隔 ~~~ ## 运行supervisord,查看是否生效,执行以下命令 ~~~ supervisord -c /etc/supervisor/ supervisord.conf ps -ef | grep ProjectName ~~~ http://supervisord.org/installing.html