Documentation ¶
Overview ¶
Package proc allows you to configure servers to be restarted with negligible downtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Listen ¶
Listen tries to create a listener on the specified tcp port. Before creating the listener, it checks to see if there is another server already using the port. If there is one, it sends a USR1 signal requesting the server to shutdown, and then attempts to to create the listener.
func ListenAndServe ¶
ListenAndServe combines Listen and Wait to also run an http server on the specified port. If it fails to obtain a listener, the program is fatally terminated. The return value is the signal received for termination
func Wait ¶
Wait creates an HTTP handler on pidURL, and serves the current process pid on it. It then creates a signal handler and waits for SIGTERM or SIGUSR1, and returns when the signal is received. A new server that comes up will query this URL. If it receives a valid response, it will send a SIGUSR1 signal and attempt to bind to the port the current server is using.