ASP. NET Core releases the centos7 configuration daemon and centos7 daemon

Source: Internet
Author: User

ASP. NET Core releases the centos7 configuration daemon and centos7 daemon

The ASP. NET Core application is released and linux runs normally in shell. However, once the shell closes the website, the daemon should be configured using the Supervisor. This article mainly records the configuration process and problems encountered in the process.

Install Supervisor

1 yum install python-setuptools

2 easy_install supervisor

Configure a Supervisor

 3 mkdir/etc/supervisor

4 echo_supervisord_conf>/etc/supervisor/supervisord. conf

5. After the preceding statement is executed, find the file supervisord. conf in the/etc/supervisor folder.

 

Next we will replace the end Of the file so that we can read our configuration file later.

Find the following at the end of the file:

;[include];files = relative/directory/*.ini

Replace the Code with the following, note that the front and back cannot contain; and space characters

[include]files = conf.d/*.conf

6. Go to the/etc/supervisor/directory to create the conf. d folder, and create the myproject. conf file under the conf. d folder.

The specific content is as follows. Note that the directory where your project file is located should be written in the Command Execution directory. It is best to change the names of the two log files in a unified manner.

[Program: myproject] command = dotnet myproject. dll; run the program's command directory =/root/mypro/; command execution directory autorestart = true; Whether to automatically restart stderr_logfile =/var/log/myproject when the program unexpectedly exits. err. log; Error log File stdout_logfile =/var/log/myproject. out. log; Output log File environment = ASPNETCORE_ENVIRONMENT = Production; process environment variable user = root; Process Execution user identity stopsignal = INT

  

Run supervisord and view

7 supervisord-c/etc/supervisor/supervisord. conf

8 ps-ef | grep myproject # This line of command is used to view all processes related to myproject. [note] myproject is the name of program: myproject above. If you see this, it indicates that the operation is successful, if it fails, you can view the Error Log File configured above.

9 supervisorctl reload # reload the configuration

The following are some commands about the Supervisor. For more information, see the link. Https://segmentfault.com

 

 

Command Description
Supervisord Start Supervisord, start and manage processes set in 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 Restart all processes that belong to the groupworker group (start and restart are the same)
Supervisorctl stop all Stop all processes. Note: neither start nor restart will load the latest configuration files.
Supervisorctl reload Load the latest configuration file, stop the original process, start and manage all processes according to the new configuration
Supervisorctl update Start a new or modified process based on the latest configuration file. Processes with no configuration changes will not be affected and restarted. Note: The process stopped with stop is displayed. It will not be restarted automatically with reload or update.

 

Tip: If you want to end the daemon process of the current application, you must end the daemon process first. Otherwise, the application cannot be killed because it will automatically restart. You can run the command first.

ps -ef | grep supervisord

Find all daemon-related processes, and then find the corresponding daemon and use the command

Kill-9 pid #-9 is enforced

End the process and kill the application process.

 

 

Http://www.cnblogs.com/zhaopei/p/netcore.html

Permanent update address: http://siyouku.cn/article/6861.html

Asp.net core development framework: https://github.com/2014fighting/CodeFrame.Web.git

 

 

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.