sudo yum update
sudo yum install libunwind libicu
sudo yum install dotnet-sdk-2.1.3 #最新版本请关注官网
sudo yum install dotnet-sdk-2.1 #注意自己版本
dotnet /usr/mytest/demo.dll
安装supervisor守护进程,保证程序持续运行
yum install python-setuptools
easy_install supervisor
mkdir /etc/supervisor #创建文件夹
echo_supervisord_conf > /etc/supervisor/supervisord.conf #创建supervisor的conf
[include] files = conf.d/*.conf #在文件尾部改为
mkdir /etc/supervisor/conf.d #创建con.d文件夹 用来保存项目的conf
conf示例
[program:MySecondCore]
command=dotnet /usr/luolai/XLSTest/MySecondCore.dll
directory=/usr/luolai/XLSTest/
autorestart=true
autorestart=true
stderr_logfile=/var/log/MySecondCore.err.log
stdout_logfile=/var/log/MySecondCore.out.log
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
stopsignal=INT
supervisord -c /etc/supervisor/supervisord.conf #启动 Supervisor 服务
设置 Supervisor 开机启动
首先为 Supervisor 新建一个启动服务脚本supervisor.service
,然后保存并上传至服务器/usr/lib/systemd/system/
目录。
脚本内容如下:
supervisord service for systemd (CentOS 7.0+) # by ET-CS (https://github.com/ET-CS) [Unit] Description=Supervisor daemon [Service] Type=forking ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown ExecReload=/usr/bin/supervisorctl $OPTIONS reload KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target
设为开机启动
systemctl enable supervisor
来源:https://www.cnblogs.com/liuxiaoji/p/9907984.html