centos设置开机启动
创建时间:2022-09-08 11:17:01
栏目:linux
linux设置开机启动可以直接修改/etc/rc.d/rc.local
在此这前,要给这个文件加上执行权限
chmod +x /etc/rc.d/rc.local
然后,修改/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
echo "123"
这样,重新开机就会执行 echo "123"了。