浏览代码

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

Solomon Hykes 11 年之前
父节点
当前提交
7b17d55599
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      server.go

+ 5 - 2
server.go

@@ -44,8 +44,11 @@ func jobInitApi(job *engine.Job) string {
 	if err != nil {
 	if err != nil {
 		return err.Error()
 		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)
 	c := make(chan os.Signal, 1)
 	signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM))
 	signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM))