在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/GO  Linux  網(wǎng)絡(luò)安全/ rc.local開機執(zhí)行用Go寫的應(yīng)用失敗

rc.local開機執(zhí)行用Go寫的應(yīng)用失敗

/etc/rc.d/rc.local和/etc/rc.local都賦予了執(zhí)行權(quán)限
/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文件輸出的可執(zhí)行文件。手動執(zhí)行可以執(zhí)行
執(zhí)行效果

[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
回答
編輯回答
撿肥皂

試試這樣

#!/bin/bash
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 
2018年6月25日 08:47
編輯回答
獨白

除了樓上說的后臺執(zhí)行試試看。
還有你要確認下直接/usr/opt/etlive-page-01/server 運行是否可以?檢查下程序里是否有寫死調(diào)用相對目錄(當前所在目錄)的地方

2018年1月14日 02:51