概述
CentOS系统和Redhat系统如下:
1.修改/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
source /root/Desktop/start.sh
“sourece /root/Desktop/start.sh”为要添加开机自启动的脚本,并且要给“/root/Desktop/start.sh”赋予执行权限(chmod +x /root/Desktop/start.sh)
2.chmod 777 rc.local
3.重启系统后就会开始执行预设置执行的脚本。(此种自启动方式不会在GUI界面显示执行的具体进程)**
最后
以上就是清秀雨为你收集整理的sh脚本开机自启动的全部内容,希望文章能够帮你解决sh脚本开机自启动所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复