Browse Source

Ensure that the pidfile is written after all logic for Barak is

complete.
pull/61/head
Jae Kwon 10 years ago
parent
commit
7eefbd23fa
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      cmd/barak/main.go

+ 6
- 6
cmd/barak/main.go View File

@ -88,12 +88,6 @@ func main() {
}
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.
fmt.Printf("Options: %v\n", options)
fmt.Printf("Barak: %v\n", barak)
@ -119,6 +113,12 @@ func main() {
}(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() {
fmt.Println("Barak shutting down")
})


Loading…
Cancel
Save