Answer the question
In order to leave comments, you need to log in
How to run a program on GO in the background and how to exit it?
Tell me how you can run the GO program in the background and how to exit it?
Thank you!
Answer the question
In order to leave comments, you need to log in
You decide whether to start or exit. I think you mean just running in the background.
What operating system are we talking about? Under linux and mac, you need to compile a binary from the program (let's say it is called prog) and run it like this:
The ampersand at the end means just running in the background.
But I advise you not to suffer from the implementation of this case manually, but look towards ready-made services that can run daemons: Upstart, Systemd, docker, etc...
And the operating system does not need to be specified ?????????????????????
On *unix, use the & character to start a program.
On Windows, compile without a console.
It's enough.
If you are talking about demons / services, then use, for example,
github.com/takama/daemon
there are still alternatives.
These packages will help turn your golang program into a service/daemon.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question