创建脚本启动目录
[supdev@localhost /]$ mkdir /export/servers/script/
创建脚本
[supdev@localhost /]$> /export/servers/script/start.sh
给脚本赋权限
[supdev@localhost /]$chmod +x /export/servers/script/start.sh
linux启动会执行这个脚本/etc/rc.d/rc.local,所以给这个赋权限
[supdev@localhost /]$sudo chmod +x /etc/rc.d/rc.local
打开脚本
[supdev@localhost /]$vi /export/servers/script/start.sh
写入你想执行的命令
#!/bin/bash
/export/servers/tomcat/tomcat.sh
打开linux默认开机启动脚本
[supdev@localhost /]$ sudo vi /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/servers/script/start.sh
最后重启
[supdev@localhost /]$reboot