系统公告
  
欢迎你光临本站!
本站内容持续添加,多种精品源码程序!高清媒体娱乐影音应有尽有~
推荐:如需要CN2高防服务器,点击这里 自助开通!!

朕已阅

 
收藏文章 楼主
linux 开机自动执行命令配置文件位置
版块:技术教程   类型:普通   作者:疯子   查看:300   回复:0   获赞:0   时间:2023-10-09 15:09:08

[root@wx-local01 ~]# cd  /etc/rc.d/


[root@wx-local01 rc.d]# ls -l  /etc/rc.d/
总用量 4
drwxr-xr-x. 2 root root 107 9月   5 10:40 init.d
drwxr-xr-x. 2 root root  45 11月 17 2020 rc0.d
drwxr-xr-x. 2 root root  45 11月 17 2020 rc1.d
drwxr-xr-x. 2 root root  45 11月 17 2020 rc2.d
drwxr-xr-x. 2 root root  72 5月  26 14:02 rc3.d
drwxr-xr-x. 2 root root  72 5月  26 14:02 rc4.d
drwxr-xr-x. 2 root root  72 5月  26 14:02 rc5.d
drwxr-xr-x. 2 root root  45 11月 17 2020 rc6.d
-rwxr-xr-x. 1 root root 881 5月  27 16:06 rc.local
[root@wx
-local01 rc.d]# tree /etc/rc.d/ /etc/rc.d/ ├── init.d │ ├── functions │ ├── mysql -> /home/wx/mysql/support-files/mysql.server │ ├── netconsole │ ├── network │ ├── README │ └── syschronzed_date ├── rc0.d │ ├── K50netconsole -> ../init.d/netconsole │ └── K90network -> ../init.d/network ├── rc1.d │ ├── K50netconsole -> ../init.d/netconsole │ └── K90network -> ../init.d/network ├── rc2.d │ ├── K50netconsole -> ../init.d/netconsole │ └── S10network -> ../init.d/network ├── rc3.d │ ├── K50netconsole -> ../init.d/netconsole │ ├── S10network -> ../init.d/network │ └── S63syschronzed_date -> ../init.d/syschronzed_date ├── rc4.d │ ├── K50netconsole -> ../init.d/netconsole │ ├── S10network -> ../init.d/network │ └── S63syschronzed_date -> ../init.d/syschronzed_date ├── rc5.d │ ├── K50netconsole -> ../init.d/netconsole │ ├── S10network -> ../init.d/network │ └── S63syschronzed_date -> ../init.d/syschronzed_date ├── rc6.d │ ├── K50netconsole -> ../init.d/netconsole │ └── K90network -> ../init.d/network └── rc.local 8 directories, 24 files

复制代码

2、设置开机自启动命令

复制代码

[root@wx-local01 rc.d]# vim /etc/rc.d/rc.local 

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local

#开机执行脚本启动harbor
sh /scripts/shell/start_harbor/power_on_self_starting_harbor.sh

复制代码

3、设置执行权限【不设置执行权限,启动后不执行文件中内容】

[root@wx-local01 rc.d]# chmod +x /etc/rc.d/rc.local


如:

脚本执行权限要打开:

执行命令 chmod +x /etc/rc.d/rc.local

rc.local 开机脚本的文件加入

sh /etc/init.d/rinetd start  

然后保存即可

 
回复列表
默认   热门   正序   倒序

回复:linux 开机自动执行命令配置文件位置

拖动滑块验证
»

Powered by rrcnzz.com

©2019 - 2024 人人站长网

本站内容来自网络仅供娱乐查阅,如侵犯版权请联系我们移除

您的IP:18.191.102.112,2024-04-28 19:38:56,Processed in 0.02448 second(s).

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息
免责声明
1、本站资源均来自网络,版权归原作者,资源和文章仅限用于学习和研究目的 。
2、不得用于商业或非法用途,否则,一切责任由使用者承担 后果!

侵权删除请致信 E-Mail:baidusw@qq.com
(0) 分享
分享

请保存二维码或复制链接进行分享

取消
已有0次打赏