M
M
Michail Wowtschuk2017-02-09 19:34:07
go
Michail Wowtschuk, 2017-02-09 19:34:07

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

2 answer(s)
A
Alexander Pavlyuk, 2017-02-09
@wowtschuk

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...

P
podavo, 2017-02-14
@podavo

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 question

Ask a Question

731 491 924 answers to any question