CentOS 7.x Custom Boot settings

Source: Internet
Author: User

One: Overview


CentOS 7 inherits the new features of Rhel 7, such as the powerful systemctl, while the use of SYSTEMCTL has changed the way in which the previous system services/etc/init.d/startup scripts, and greatly improves the efficiency of system services. However, the configuration of services and the past has also undergone great differences.

CentOS 7 Service Systemctl script is stored in:/usr/lib/systemd/, the system and the user (users) of the points, such as the need to boot without logging on to run the program, or the existence of system services, that is:/usr/lib/ Systemd/system directory, and each service ends with a. Service.


Centos System Services Script directory:

/usr/lib/systemd

If you need to boot the program can be run without logging in, there is system services (systems), that is:

/usr/lib/systemd/system


2. Start configuration

2.1 Environmental ===>

1. Add self-starting service: UWSGI

2. Self-booting script to write well

3. I put the start-up script in the/etc/init.d/directory, and add the Execute permission


2.2 Configuring ===>

Each service ends with a. Service and is typically divided into 3 parts: [Unit], [service], and [Install], which I wrote to run the Uwsgi project with the following details:

[Email protected] ~]# cd/usr/lib/systemd/system[[email protected] system]# vim uwsgid.service[unit]description= Uwsgidafter=network.target[service]type=forkingexecstart=/etc/init.d/uwsgid StartExecReload=/etc/init.d/uwsgid Restartexecstop=/etc/init.d/uwsgid Stopprivatetmp=true [Install]wantedby=multi-user.target

The service script is saved in the/usr/lib/systemd/system directory with 754 permissions, as written above

[Email protected] system]# chmod 754 Uwsgid.service


The configuration file is interpreted as follows:

Description of the [Unit] ===> Service

Description: Description Service
After: Describe the service category

  [Service]         ===>       Settings for service run parameters

       type=forking: is the background run form
       execstart: Specific Run command for the service
        Execreload: Restart command
       privatetmp=true: Represents a separate temporary space for the service
< Span style= "Padding:0px;margin:0px;color:rgb (255,0,0);" >      Note: The start, restart, and stop commands for [Service] all require absolute path

[Install] ===> settings for the service installation, can be set to multi-user

--------------------------------------------------------------------------------

3. Set up boot from boot


Systemctl Enable Uwsgid.service


4. Other commands

Take the httpd service as an example

Task Old instructions New directives
Enable a service to start automatically Chkconfig--level 3 httpd on Systemctl Enable Httpd.service
Make a service not start automatically Chkconfig--level 3 httpd off Systemctl Disable Httpd.service
check service service httpd status  systemctl status httpd.service 

         <== service details

 systemctl is-active httpd.service 

<==  Show only Active

Show all services that have been started Chkconfig--list Systemctl list-units--type=service
Start a service Service httpd Start Systemctl Start Httpd.service
Stop a service Service httpd Stop Systemctl Stop Httpd.service
Restart a service Service httpd Restart Systemctl Restart Httpd.service


Start Nginx Service

Systemctl Start Nginx.service

Set up boot from

Systemctl Enable Nginx.service

Stop Boot from booting

Systemctl Disable Nginx.service

View the current status of the service

Systemctl Status Nginx.service

Restart Service

Systemctl Restart Nginx.service

View all services that have been started

Systemctl list-units--type=service


Reference post: http://blog.csdn.net/yuanguozhengjust/article/details/38019923

Http://www.centoscn.com/CentOS/config/2015/0507/5374.html




This article is from the "Potato" blog, please be sure to keep this source http://zhaoyulin.blog.51cto.com/11665101/1871435

CentOS 7.x Custom Boot settings

Related Article

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.