In this article (How to run golang web server forever on Linux) we know an old method to run golang web server forever on Linux. Now we have a new method to do that.
PMGO
is a lightweight process manager written in Golang for Golang applications. It helps you keep your applications alive forever, reload and start them from the source code.
Install pmgo
Step 1:
go get github.com/struCoder/pmgo
Step 2:
cp $GOPATH/bin/pmgo /usr/local/bin
Use pmgo to run golang web server forever
pmgo start path/to/source/directory app-name
You can stop, restart or delete your app from PMGO:
$ pmgo stop app-name $ pmgo restart app-name $ pmgo delete app-name