Christopher Shroba
Christopher Shroba

Reputation: 7544

Can I daemonize a golang process without external tools?

I've seen many different suggestions for how to daemonize an application written in Go, including using upstart or init.d. Why not just do it yourself though? It seems like the steps are simple enough:

(source)

So why not just do this in your program, rather than depending on third party software to do a simple task for you?

Upvotes: 4

Views: 1907

Answers (1)

Didier Spezia
Didier Spezia

Reputation: 73226

Messing directly with fork() from a Go program is perilous. A typical deamonize implementation based on an equivalent C program is not safe.

You may be interested by the approach used by the following package: https://github.com/VividCortex/godaemon

Upvotes: 1

Related Questions