Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use Supervisor to guard dotnetcore program

Shulou Source: shulou.com Published: 2022-05-31 14:15:56 10月04日 Update

This article mainly explains "how to use Supervisor to guard dotnetcore program". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use Supervisor to guard dotnetcore program".

Environmental preparation

1. Set the nginx service to boot

Systemctl enable nginx.servic

two。 Install Supervisor

Yum install python-setuptoolseasy_install supervisor

3. Configure Supervisor

Mkdir / etc/supervisorecho_supervisord_conf > / etc/supervisor/supervisord.conf# specifies the profile supervisord-c / etc/supervisor/supervisord.conf

Specify the program configuration of the daemon

Vim / etc/supervisor/supervisord.conf

Increase at the end

[include] files=conf.d/*.conf configuration Supervisor boot

Create a new "supervisord.service" file

# dservice for systemd (CentOS 7.0 +) # by ET-CS (https://github.com/ET-CS)[Unit]Description=Supervisor daemon [service] Type=forkingExecStart=/usr/bin/supervisord-c / etc/supervisor/supervisord.confExecStop=/usr/bin/supervisorctl shutdownExecReload=/usr/bin/supervisorctl reloadKillMode=processRestart=on-failureRestartSec=42s [Install] WantedBy=multi-user.target

Copy the file to "/ usr/lib/systemd/system/supervisord.service"

Execute command: systemctl enable supervisord

Configure the daemon

New configuration

Vim / etc/supervisor/conf.d/acore.dll.conf

[program:acore.dll] command=/bin/bash-c "dotnet acore.dll server.urls= http://127.0.0.1:3000/"directory=/root/dotnetcore/acore/autorestart=falsestderr_logfile=/var/log/acore.dll.err.logstdout_logfile=/var/log/acore.dll.out.logenvironment=ASPNETCORE_ENVIRONMENT=Developmentuser=rootstopsignal=INT

Reload configuration

Supervisorctl reloadsupervisorctl start acore.dll

Check to see if it is pulled up by the daemon

Restart the computer to see if it starts automatically

Thank you for reading, the above is the content of "how to use Supervisor to guard dotnetcore program". After the study of this article, I believe you have a deeper understanding of how to use Supervisor to guard dotnetcore program, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Configuration programs files learning content commands that is ideas situations copies articles more environment computers knowledge knowledge points articles followers processes questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple OPPO Reno Shulou Tech Info Docker