Skip to content

Latest commit

 

History

History
102 lines (75 loc) · 2.52 KB

开机启动.md

File metadata and controls

102 lines (75 loc) · 2.52 KB

开机启动

oracle

/etc/rc.d/rc.local

[root@localhost ~]# cat /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
su - oracle -c "/usr/local/oracle/product/11.2.0/db_1/bin/lsnrctl start"
su - oracle -c "/usr/local/oracle/product/11.2.0/db_1/bin/dbstart startup"

tomcat

/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
export JAVA_HOME=/usr/local/java/jdk1.8.0_261
/usr/local/server/bin/startup.sh
/usr/local/eflow-server/bin/startup.sh

nginx

/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
/usr/local/nginx/sbin/nginx

/etc/rc.d/rc.local 不执行

/etc/rc.local是/etc/rc.d/rc.local的软链接

确认 /etc/rc.local 可执行

[root@localhost ~]# ls -l /etc/rc.local
lrwxrwxrwx. 1 root root 13 Jan 21  2021 /etc/rc.local -> rc.d/rc.local

确认 /etc/rc.d/rc.local 可执行

[root@localhost ~]# ls -l /etc/rc.d/rc.local
-rw-r--r-- 1 root root 621 Jul 28 15:20 /etc/rc.d/rc.local

看到 /etc/rc.d/rc.local 没有执行权限

添加执行权限

chmod +x /etc/rc.d/rc.local
reboot

Linux启动脚本rc.local 不执行的解决方法 - 码农有道 - 博客园 (cnblogs.com)