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

Write shell script in ubuntu to boot automatically (recommended)

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

Share

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

Scripts are written so that you don't have to start various services manually (also to be lazy)

1. Enter terminal input

Create a script file with the suffix .sh

Touch test.sh

Edit script

Vim test.sh

Test.sh scripting content

two。 Write test.sh scripts

#! / bin/bash### BEGIN INIT INFO# Provides: test# Required-Start: $remote_fs $syslog# Required-Stop: $remote_fs $syslog# Default-Start: 2 3 4 "Default-Stop: 0 1" Short-Description: start test# Description: start test### END INIT INFO# script content cd / home/Desktop/./test.shexit 0

Start with #! / bin/bash and end with the script content exit0

3. Move the test.sh file to / etc/init.d directory

Move Fil

Sudo mv test.sh / etc/init.d/

Add permissions to the file

Chmod + 750test.sh

Set the boot to start automatically

Sudo update-rc.d test.sh defaults

4. Such a boot automation script is completed.

Summary

The above is the ubuntu introduced by the editor to write the shell script to start automatically. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank 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