CentOS 7 Setup Boot service, add custom system services CentOS 7 shutdown Firewall CentOS 7.2 CentOS 7 64-bit download

Source: Internet
Author: User
CentOS 7 Setup Boot service to add custom system services

    • Create a service file
    • Save Directory
    • Set up boot from
    • Other commands

1. Create a service file

File path

vim /usr/lib/systemd/system

Service file Content

[Unit]Description=nginx - high performance web serverAfter=network.target remote-fs.target nss-lookup.target[Service]Type=forkingExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s stop[Install]WantedBy=multi-user.target

Document Content Interpretation

[Unit]:服务的说明Description:描述服务After:描述服务类别[Service]服务运行参数的设置Type=forking是后台运行的形式ExecStart为服务的具体运行命令ExecReload为重启命令ExecStop为停止命令PrivateTmp=True表示给服务分配独立的临时空间注意:启动、重启、停止命令全部要求使用绝对路径[Install]服务安装的相关设置,可设置为多用户

2. Save the Directory

Save in Directory with 754 permissions:

/usr/lib/systemd/system

3. Set up boot from boot

Execute under any directory

systemctl enable nginx.service

4. Other commands

Start Nginx Service

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

list-units --type=service

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the CentOS 7 Setup Boot service, add custom system services, including the CentOS 7 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.