Linux下Golang编译程序在后台运行及开机启动
编译
需要在项目根目录设置GOPATH为amd64
set GOPACH=amd64
设置GOOS为linux
set GOOS=linux
指定输出文件名
go build test.go
指定输出文件名
go build -o custom_name
修改可执行权限
chmod 777 程序名称
程序后台运行
nohup ./custom_name &
不输出错误信息
nohup ./custom_name >/dev/null 2>&1 &
关闭程序
查询进程号
ps aux|grep custom_name
关闭进程
kill 进程编号
开机启动golang
vi /etc/rc.local
你的文章让我感受到了不一样的视角,非常精彩。 https://www.4006400989.com/qyvideo/92199.html
你的文章内容非常卖力,让人点赞。 https://www.yonboz.com/video/85401.html
你的文章让我感受到了不一样的风景,谢谢分享。 https://www.yonboz.com/video/23561.html
你的文章内容非常专业,让人佩服。 https://www.yonboz.com/video/54081.html
你的文章总是能给我带来欢乐,谢谢你!http://www.lannadecn.com
看到你的文章,我仿佛感受到了生活中的美好。http://www.gzhplb.com
每次看到你的文章,我都觉得时间过得好快。http://www.shhengqianjs.com
每次看到你的文章,我都觉得时间过得好快。http://www.shhengqianjs.com
每次看到你的文章,我都觉得时间过得好快。http://www.shhengqianjs.com
看到你的文章,我仿佛感受到了生活中的美好。http://www.letujiaotong.com
你的文章内容非常卖力,让人点赞。http://www.thfc420.com