From e1a71453c70c10df0aa2698de18c0ac43a35ab2e Mon Sep 17 00:00:00 2001 From: tidwall Date: Tue, 19 Mar 2019 13:49:35 -0700 Subject: [PATCH] Do not ignore SIGHUP Use the `--nohup` flag or `nohup` command. --- cmd/tile38-server/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/tile38-server/main.go b/cmd/tile38-server/main.go index 04cdd24c..434a552d 100644 --- a/cmd/tile38-server/main.go +++ b/cmd/tile38-server/main.go @@ -37,6 +37,7 @@ var ( cpuprofile string memprofile string pprofport int + nohup bool ) // TODO: Set to false in 2.* @@ -101,6 +102,7 @@ Advanced Options: --protected-mode yes/no : protected mode (default: yes) --threads num : number of network threads (default: num cores) --evio yes/no : use the evio package (default: no) + --nohup : do not exist on SIGHUP Developer Options: --dev : enable developer mode @@ -179,6 +181,9 @@ Developer Options: case "--dev", "-dev": devMode = true continue + case "--nohup", "-nohup": + nohup = true + continue case "--appendonly", "-appendonly": i++ if i < len(os.Args) { @@ -366,7 +371,7 @@ Developer Options: signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) go func() { for s := range c { - if s == syscall.SIGHUP { + if s == syscall.SIGHUP && nohup { continue } log.Warnf("signal: %v", s) @@ -375,6 +380,8 @@ Developer Options: switch { default: os.Exit(-1) + case s == syscall.SIGHUP: + os.Exit(1) case s == syscall.SIGINT: os.Exit(2) case s == syscall.SIGQUIT: