Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add boot startup service for centos7

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to add boot startup service to centos7". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Add self-booting service

It is very convenient to add a self-starting service to centos7. You only need two commands (take Jenkins as an example):

Systemctl enable jenkins.service # set jenkins service to self-startup service sysstemctl start jenkins.service # start jenkins service

Second, add a boot script

There are two common ways to add scripts to centos7. Take the script autostart.sh as an example:

#! / bin/bash#description: boot script / usr/local/tomcat/bin/startup.sh # start tomcat

Method one

1. Give the script executable permissions (/ opt/script/autostart.sh is your script path)

Chmod + x / opt/script/autostart.sh

one

2. Open the / etc/rc.d/rc/local file and add the following at the end

/ opt/script/autostart.sh

3. In centos7, the permission of / etc/rc.d/rc.local is reduced, so you need to execute the following command to give it executable permission.

Chmod + x / etc/rc.d/rc.local

Method two

1. Move the script to / etc/rc.d/init.d directory

Mv / opt/script/autostart.sh / etc/rc.d/init.d

2. Increase the executable permissions of the script

Chmod + x / etc/rc.d/init.d/autostart.sh

3. Add a script to the startup project

Cd / etc/rc.d/init.dchkconfig-- this is the end of add autostart.shchkconfig autostart.sh on's "how to add Boot Startup Service to centos7". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report