重启设置
在 /etc/rc.d/rc.local 文件服务器重启后会被执行是用于添加开机启动命令,/etc/rc.local是/etc/rc.d/rc.local的软连接,软连接相当于windows的快捷键
打开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
# 自启 禅道 服务
/opt/zbox/zbox start
# 自启 service 应用服务
/opt/app/service/bin/start.sh
在/var/lock/subsys/ 下创建local文件
作用:
检验rc.local是否执行过,执行过的话就会有local文件(默认没有执行)
重启测试
[root@xxx ~]# reboot
问题
1.服务未自启
#要执行的脚本没有执行权限,变更权限
[root@xxx ~]# chmod 775 /ext/rc.d/rc.local
2.再次确认/etc/rc.d/rc.local文件有执行权限
[root@xxx ~]# ls /etc/rc.local
[root@xxx ~] lrwxrwxrwx 1 root root 13 mar 9 19:30 /etc/rc.local -> rc.d/rc.local
若没有执行权限,需赋予
[root@xxx ~]# chmod 775 /etc/rc.local
3.最后检查脚本是否有问题