/etc/rc.d/rc.local和/etc/rc.local都赋予了执行权限
/etc/rc.d/rc.local和/etc/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/opt/nginx/sbin/nginx
/usr/opt/etlive-page-01/server
/usr/opt/etlive-page-02/server
service iptables start
server是在这台linux上面编译go文件输出的可执行文件。手动执行可以执行
执行效果
[root@Nginx02 etlive-page-01]# pwd
/usr/opt/etlive-page-01
[root@Nginx02 etlive-page-01]# ./server
2018/04/04 18:01:59 [I] http server Running on http://:8080
试试这样