What is the proper way to start a Go program as a daemon in Ubuntu ? I will then monitor it with Monit. Should I just do something like:
go run myapp.go &
There is a bug report regarding the ability to daemonize from within a Go program: http://code.google.com/p/go/issues/detail?id=227
But if what you are after is just detaching from the process I have seen recommendations to either do one of the following:
nohup go run myapp.go
or
go run myapp.go & disown
You can also make use of a process manager, like writing an init.d
, Startup
, or using something like Supervisor, which I personally really like.