R
R
Roman Rakzin2015-07-26 17:54:35
go
Roman Rakzin, 2015-07-26 17:54:35

How to catch any error in a golang application and reload the program itself?

How to catch any error in a golang application and reload the program itself?
It happens that there are errors that I have not processed and so that the application does not become at all and then works correctly, you need to somehow restart, but how will the binary launch itself? can I write some .bat file or how is it done at all?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Filinkov, 2015-07-26
@vitfil

Well, if the program crashes on an error, the OS will kill the process as well. Check with cron for the presence of it and run it if it is not there.

S
sim3x, 2015-07-26
@sim3x

On Windows, no idea how this is done
On posix-compatible systems, it is done through daemon
Let the program return 1, and askubuntu.com/questions/191709/how-to-run-a-progra...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question