写了个goods_wg.go在/data0/go/src/xiyu/目录,我的go安装在/usr/local/go/目录。我想让goods_wg.go在linux下面实现开机就自动运行这个go文件。我把以下命令
/usr/local/go/bin/go run /data0/go/src/xiyu/goods_wg.go &放到/etc/rc.local里面去,但是开机的时候。依然无法运行这段go,但是我在linux开机之后,直接在linux下面运行
/usr/local/go/bin/go run /data0/go/src/xiyu/goods_wg.go &
这段命令,就能正常运行goods_wg.go了。请问要如何处理呢
谢谢你的指点,首先这段go程序肯定没问题。可以单独跑,其次我直接在linux命令行下面输入/usr/local/go/bin/go run /data0/go/src/xiyu/goods_wg.go & 也可以让go执行,但是我把他放到/etc/rc.local里的时候。就无法执行了。
#2
更多评论
$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
#1