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

Set up the method of starting and closing scripts on Gentoo Linux

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

Share

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

This article is about how to set up startup and shutdown scripts on Gentoo Linux. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

It is sometimes necessary to run commands or shell scripts during system startup and shutdown. This helps to start the service when the system starts and stop the service when the system shuts down.

Scripts with the suffix .start in the / etc/local.d/ directory will now be executed at system startup, and all scripts with the suffix .stop will be executed during system shutdown. First make sure that the local.d script is enabled using the following steps.

Enable local.d script

To start the local.d script at boot time, add its init.d script to the default run level

# rc-update add local default

Now, start the service by performing an OpenRC check on the stopped service at the default run level:

# rc-service local start

Run the script at startup

Create a script / etc/local.d/myService.start and put your content in it. This will be performed during system boot.

# vi / ETC _ Show below message on system startupecho local.d _ Welcome back!

Run the script on shutdown

Create a script / etc/local.d/myservice.stop and put your content in it. This will be performed during the system shutdown.

# vi / etcUniverse local.dpacpacer myService.stoppages bind Show below message on system shutdownecho sh # Show below message on system shutdownecho "Good bye! thank you for reading! this is how to set up startup and shutdown scripts on Gentoo Linux. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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