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 Boot script in Linux system

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

Share

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

This article mainly introduces how to add a boot script to the Linux system, which is very detailed and has a certain reference value. Interested friends must read it!

1. Write a script autostart.sh (here, take starting the redis service as an example). The script content is as follows:

#! / bin/sh # chkconfig: 2345 8090 # description: boot the script program automatically # Open the redis service port to 6379 / usr/local/service/redis-2.8.3/src/redis-server-- port 6379 & the first line of the script "#! / bin/sh" tells the system which shell to use The second line of the script "# chkconfig: 2345 8090" indicates that the runlevel start, startup number (S80), and shutdown number (K90) are started at run level 2max / 3max / 4max / 5; the third line of the script represents the description of the service.

Note: the second and third lines must be written, and errors such as "Service autostart.sh does not support chkconfig" will occur.

two。 Move the written autostart.sh script to the / etc/rc.d/init.d/ directory

3. Assign executable permissions to the script

Cd / etc/rc.d/init.d/ chmod + x autostart.sh4. Add a script to the boot auto startup project

Chkconfig-add autostart.sh chkconfig autostart.sh on above is all the content of this article "how to add boot script to Linux system". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report