httpapi: don't create a pidfile if it isn't set in the configuration

This commit is contained in:
Solomon Hykes 2013-10-27 06:51:43 +00:00
parent 958b4a8757
commit 7b17d55599
1 changed files with 5 additions and 2 deletions

View File

@ -44,8 +44,11 @@ func jobInitApi(job *engine.Job) string {
if err != nil {
return err.Error()
}
if err := utils.CreatePidFile(srv.runtime.config.Pidfile); err != nil {
log.Fatal(err)
if srv.runtime.config.Pidfile != "" {
job.Logf("Creating pidfile")
if err := utils.CreatePidFile(srv.runtime.config.Pidfile); err != nil {
log.Fatal(err)
}
}
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM))