This project is inspired by server-starter, but a bit different in that graceful-restarter provides graceful shutdown and restart on TCP layer.
$ curl -L -O https://github.com/teru01/graceful-restarter/releases/download/1.0/grestarter
$ chmod +x grestarter
$ mv grestarter /usr/local/bin
$ grestarter [-L IP:Port] program arg1 arg2 ...
program
has to use "github.com/teru01/graceful-restarter/graceful-listener" as listener (see example directory).
-
The
grestarter
command makes a socket listening on the given IP:Port (default 127.0.0.1:0). -
Then,
grestarter
passes the opened socket file descriptor toprogram
by launching as a child process. -
Incoming requests are handled by the child process.
-
If
grestarter
process got aSIGHUP
signal, it sendsSIGTERM
to all its child processes.