Ensure that the pidfile is written after all logic for Barak is
complete.
This commit is contained in:
parent
e294b1f954
commit
7eefbd23fa
|
@ -88,12 +88,6 @@ func main() {
|
||||||
}
|
}
|
||||||
barak.registries = options.Registries
|
barak.registries = options.Registries
|
||||||
|
|
||||||
// Write pid to file.
|
|
||||||
err = AtomicWriteFile(barak.rootDir+"/pidfile", []byte(Fmt("%v", barak.pid)))
|
|
||||||
if err != nil {
|
|
||||||
panic(Fmt("Error writing pidfile: %v", err))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debug.
|
// Debug.
|
||||||
fmt.Printf("Options: %v\n", options)
|
fmt.Printf("Options: %v\n", options)
|
||||||
fmt.Printf("Barak: %v\n", barak)
|
fmt.Printf("Barak: %v\n", barak)
|
||||||
|
@ -119,6 +113,12 @@ func main() {
|
||||||
}(registry)
|
}(registry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write pid to file. This should be the last thing before TrapSignal.
|
||||||
|
err = AtomicWriteFile(barak.rootDir+"/pidfile", []byte(Fmt("%v", barak.pid)))
|
||||||
|
if err != nil {
|
||||||
|
panic(Fmt("Error writing pidfile: %v", err))
|
||||||
|
}
|
||||||
|
|
||||||
TrapSignal(func() {
|
TrapSignal(func() {
|
||||||
fmt.Println("Barak shutting down")
|
fmt.Println("Barak shutting down")
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue