LINUX系统中设置开机⾃动执⾏命令###
1、开机⾃动执⾏命令配置⽂件位置
[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⽉510:40 init.d
drwxr-xr-x. 2 root root  45 11⽉172020 rc0.d
drwxr-xr-x. 2 root root  45 11⽉172020 rc1.d
drwxr-xr-x. 2 root root  45 11⽉172020 rc2.d
drwxr-xr-x. 2 root root  72 5⽉2614:02 rc3.d
drwxr-xr-x. 2 root root  72 5⽉2614:02 rc4.d
drwxr-xr-x. 2 root root  72 5⽉2614:02 rc5.d
drwxr-xr-x. 2 root root  45 11⽉172020 rc6.d
-rwxr-xr-x. 1 root root 881 5⽉2716:06 rc.local
[root@wx-local01 rc.d]# tree /etc/rc.d/
/etc/rc.d/
├── init.d
linux循环执行命令脚本│├── 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
###

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。