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 configure the Boot self-boot execution script for Linux

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

Share

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

This article mainly introduces how to configure Linux boot execution script, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Script qidong.sh [root@c69-01 scripts] # vim / server/scripts/qidong.sh [root@c69-01 scripts] # cat / server/scripts/qidong.sh #! / bin/bash / bin/echo $(/ bin/date +% Flying% T) > > / tmp/qidong.log method 1: modify / etc/rc.local

/ etc/rc.local, which is a linked file

[root@c69-01 ~] # ll / etc/rc.local lrwxrwxrwx. 1 root root 13 Feb 5 10:03 / etc/rc.local-> rc.d/rc.local

Modify / etc/rc.local file

[root@c69-01 scripts] # tail-n 1 / etc/rc.local / bin/bash / server/scripts/qidong.sh > / dev/null 2 > / dev/null

Restart the system to view the results

[root@c69-01 ~] # cat / tmp/qidong.log 2018-02-1919 1911 1911 1911 / 1911 # cat / tmp/qidong.log 2018-02-1931 1911 1911 1911 19

The script has been booted and started automatically

Method 2: chkconfig management

Delete the configuration of method 1

[root@c69-01 ~] # vim / etc/init.d/test #! / bin/bash # chkconfig: 3 88 88 / bin/bash / server/scripts/qidong.sh > / dev/null 2 > / dev/null [root@c69-01 ~] # chmod + x / etc/init.d/test

Add to chkconfig, boot automatically

[root@c69-01] # chkconfig-- add test [root@c69-01] # chkconfig-- list test test 0:off 1:off 2:off 3:on 4:off 5:off 6:off

Restart the system to view the results

[root@c69-01 ~] # cat / tmp/qidong.log 2018-02-1919 1951-02-1911 2315 1951-02-1931 1951-02-1911 1315 5915 10

The operation is successful

Turn it off and start.

[root@c69-01 ~] # chkconfig test off [root@c69-01 ~] # chkconfig-- list test test 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Remove test from chkconfig Management

[root@c69-01 ~] # chkconfig-- list test test 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@c69-01 ~] # chkconfig-- del test [root@c69-01 ~] # chkconfig-list test service test supports chkconfig, but is not referenced in any runlevel (run 'chkconfig-- add test') Thank you for reading this article carefully I hope the article "how to configure the boot execution script for Linux" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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