1. 安裝supervisor
apt-get install supervisor
2.新建supervisor配置文件。使用以下命令在linux 命令行
echo_supervisord_conf > /etc/supervisord.conf
3. 修改supervisor配置文件
vim /etc/supervisord.conf
移至文件內容結尾supervisord.conf。加include,指定啟動時,需要啟動的程序。
[include] files = /etc/supervisor/conf.d/*.conf
3. 新增.net core 啟動的配置文件
vim /etc/supervisor/conf.d/hwappService.conf
然后填寫以下內容:
[program:hwappService] command=dotnet /root/data/example/hwapp/bin/Debug/netcoreapp1.1/hwapp.dll //要執行的命令 directory=/root/data/example/hwapp/bin/Debug/netcoreapp1.1/ //dll所在的文件夾 autostart=true autorestart=true stderr_logfile=/var/log/sampleMicroService.err.log //錯誤日志 stdout_logfile=/var/log/sampleMicroService.out.log //輸出日志 user=root //用戶 stopsignal=INT
備注:linux中 ~指的是 /user。如果不清楚~是啥。可以在linux是用echo ~ 打印出來。
