ASP. NET Core release CENTOS7 configuration daemon

Source: Internet
Author: User

It is normal for an ASP. NET core application to publish Linux to run in Putty. But Putty closed the site is also closed, so to configure the daemon, with the supervisor, this article mainly records the configuration process and process problems encountered

Installation Supervisor and Configuration Supervisor
1.yum Install python-setuptools2.easy_install supervisor  /etc/>/etc/supervisor/ supervisord.conf  #配置 Supervisor

4. Configuration

cd/etc/Supervisorls

supervisord.conf file

5. At the end of the document

= relative/directory/*. ini

Change ("note" to remove; and no spaces)

= CONF.D/*. conf

6. Go /etc/supervisor/ to Directory new conf.d folder, conf.d new file under Folder netcoreDemo.conf
Content ("Note" in the second line of the third row of comments, according to the actual name filled in)

MKDIR/ETC/SUPERVISOR/CONF.D    -- Create Conf.d folder lscd conf.dvi netcore.conf    --Create Netcore file and add content to it

[Program:netcore]command=dotnet mhqtalks.dll; (note) The command to run the program directory=/home/netcore/ ; (note Note) corresponding to the storage directory of your project, this place a lot of beginners wrong!!! AutoRestart=true  ; If the program quits unexpectedly automatically restarts Stderr_logfile=/var/log/  WebApplication1.err.log; Error log file Stdout_logfile=/var/log/webapplication1.  out . log; output log file Environment=aspnetcore_environment=Production; Process environment variable User=root; User identity for Process execution stopsignal=int
Run Supervisord and view
7  
8  Ps-ef | grep Netcore  # This line of command is to view all processes about Netcore, "note" Netcore is named above Program:netcore, if you see such as, instructions run successfully, if not successful can see the above configuration of the error log file

9  Supervisorctl Reload  #最后重新载入配置
Configuring Supervisor Boot-up

Open Directory /usr/lib/systemd/system/ new filesupervisord.service
Content:

 for 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

Execute command:

systemctl enable Supervisord   is-enabled supervisord #来验证是否为开机启动

To this, the completion. Now you have to go back to the computer without any control, directly to the deployed site.

Here are some commands for Supervisor, refer to link https://segmentfault.com

Command Description
Supervisord Start Supervisord, start, manage the processes set up in the configuration
Supervisorctl Stop MyProject Stop a process (programxxx), Programxxx is the value configured in [Program:chatdemon], this example is Chatdemon
Supervisorctl Start MyProject Start a process
Supervisorctl Restart MyProject Restart a process
Supervisorctl Stop Groupworker Restarts all processes that belong to the group named Groupworker (Start,restart)
Supervisorctl Stop All Stop all processes, note: Start, restart, stop will not load the latest configuration file
Supervisorctl Reload Load the latest configuration file, stop the original process and start and manage all processes in the new configuration
SUPERVISORCTL Update Depending on the latest configuration file, a new configuration or a changed process is initiated, and the configuration of the unchanged process is not affected and restarted. Note: Displays a process that stops with stop and does not automatically restart with reload or update

Tip: If you want to end a daemon, we can Ps-ef | grep Supervisord Isolate all daemon-related processes

And then end the process with the kill-9 PID.

ASP. NET Core Publishing CENTOS7 configuration daemon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.