Do not ignore SIGHUP
Use the `--nohup` flag or `nohup` command.
This commit is contained in:
parent
d6f7697e2e
commit
e1a71453c7
@ -37,6 +37,7 @@ var (
|
|||||||
cpuprofile string
|
cpuprofile string
|
||||||
memprofile string
|
memprofile string
|
||||||
pprofport int
|
pprofport int
|
||||||
|
nohup bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Set to false in 2.*
|
// TODO: Set to false in 2.*
|
||||||
@ -101,6 +102,7 @@ Advanced Options:
|
|||||||
--protected-mode yes/no : protected mode (default: yes)
|
--protected-mode yes/no : protected mode (default: yes)
|
||||||
--threads num : number of network threads (default: num cores)
|
--threads num : number of network threads (default: num cores)
|
||||||
--evio yes/no : use the evio package (default: no)
|
--evio yes/no : use the evio package (default: no)
|
||||||
|
--nohup : do not exist on SIGHUP
|
||||||
|
|
||||||
Developer Options:
|
Developer Options:
|
||||||
--dev : enable developer mode
|
--dev : enable developer mode
|
||||||
@ -179,6 +181,9 @@ Developer Options:
|
|||||||
case "--dev", "-dev":
|
case "--dev", "-dev":
|
||||||
devMode = true
|
devMode = true
|
||||||
continue
|
continue
|
||||||
|
case "--nohup", "-nohup":
|
||||||
|
nohup = true
|
||||||
|
continue
|
||||||
case "--appendonly", "-appendonly":
|
case "--appendonly", "-appendonly":
|
||||||
i++
|
i++
|
||||||
if i < len(os.Args) {
|
if i < len(os.Args) {
|
||||||
@ -366,7 +371,7 @@ Developer Options:
|
|||||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||||
go func() {
|
go func() {
|
||||||
for s := range c {
|
for s := range c {
|
||||||
if s == syscall.SIGHUP {
|
if s == syscall.SIGHUP && nohup {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Warnf("signal: %v", s)
|
log.Warnf("signal: %v", s)
|
||||||
@ -375,6 +380,8 @@ Developer Options:
|
|||||||
switch {
|
switch {
|
||||||
default:
|
default:
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
|
case s == syscall.SIGHUP:
|
||||||
|
os.Exit(1)
|
||||||
case s == syscall.SIGINT:
|
case s == syscall.SIGINT:
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
case s == syscall.SIGQUIT:
|
case s == syscall.SIGQUIT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user