mirror of https://github.com/hak5/overseer.git
added NoRestart option
parent
ca280e1a6b
commit
a5ef7ca2eb
|
@ -126,7 +126,7 @@ See [Config](https://godoc.org/github.com/jpillora/overseer#Config)uration optio
|
|||
func main() {
|
||||
overseer.Run(overseer.Config{
|
||||
Program: prog,
|
||||
NoRestartAfterFetch: true
|
||||
NoRestart: true,
|
||||
Fetcher: &fetcher.HTTP{
|
||||
URL: "http://localhost:4000/binaries/myapp",
|
||||
Interval: 1 * time.Second,
|
||||
|
|
|
@ -47,7 +47,11 @@ type Config struct {
|
|||
Debug bool
|
||||
//NoWarn disables warning [overseer] logs.
|
||||
NoWarn bool
|
||||
//NoRestart disables all restarts, this option essentially converts
|
||||
//the RestartSignal into a "ShutdownSignal".
|
||||
NoRestart bool
|
||||
//NoRestartAfterFetch disables automatic restarts after each upgrade.
|
||||
//Though manual restarts using the RestartSignal can still be performed.
|
||||
NoRestartAfterFetch bool
|
||||
//Fetcher will be used to fetch binaries.
|
||||
Fetcher fetcher.Interface
|
||||
|
|
|
@ -368,9 +368,10 @@ func (mp *master) fork() error {
|
|||
}
|
||||
}
|
||||
mp.debugf("prog exited with %d", code)
|
||||
//if a restart wasn't requested, proxy
|
||||
//through the exit code via the main process
|
||||
if !mp.restarting {
|
||||
//if a restarts are disabled or if it was an
|
||||
//unexpected creash, proxy this exit straight
|
||||
//through to the main process
|
||||
if mp.NoRestart || !mp.restarting {
|
||||
os.Exit(code)
|
||||
}
|
||||
case <-mp.descriptorsReleased:
|
||||
|
|
|
@ -127,15 +127,19 @@ func (sp *slave) watchSignal() {
|
|||
signal.Stop(signals)
|
||||
sp.debugf("graceful shutdown requested")
|
||||
//master wants to restart,
|
||||
sp.state.GracefulShutdown <- true
|
||||
close(sp.state.GracefulShutdown)
|
||||
//release any sockets and notify master
|
||||
if len(sp.listeners) > 0 {
|
||||
//perform graceful shutdown
|
||||
for _, l := range sp.listeners {
|
||||
l.release(sp.Config.TerminateTimeout)
|
||||
}
|
||||
//signal release of held sockets
|
||||
sp.masterProc.Signal(SIGUSR1)
|
||||
//signal release of held sockets, allows master to start
|
||||
//a new process before this child has actually exited.
|
||||
//early restarts not supported with restarts disabled.
|
||||
if !sp.NoRestart {
|
||||
sp.masterProc.Signal(SIGUSR1)
|
||||
}
|
||||
//listeners should be waiting on connections to close...
|
||||
}
|
||||
//start death-timer
|
||||
|
|
Loading…
Reference in New Issue