From 4a1f36c3cc3d93633299a2f71826ee0198adaef0 Mon Sep 17 00:00:00 2001
From: Bwko <bouwko@gmail.com>
Date: Sat, 14 Jan 2017 03:15:43 +0100
Subject: [PATCH] Don't create a default pid file (#637)

---
 cmd/web.go                 | 2 +-
 modules/setting/setting.go | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/cmd/web.go b/cmd/web.go
index a69bcf4b2..2ab680ecf 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -62,7 +62,7 @@ and it takes care of all the other things for you`,
 		},
 		cli.StringFlag{
 			Name:  "pid, P",
-			Value: "custom/run/app.pid",
+			Value: "/var/run/gitea.pid",
 			Usage: "Custom pid file path",
 		},
 	},
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 275e4b58a..523582f70 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -515,12 +515,10 @@ please consider changing to GITEA_CUSTOM`)
 		}
 	}
 
-	if len(CustomPID) == 0 {
-		CustomPID = CustomPath + "/run/app.pid"
+	if len(CustomPID) > 0 {
+		createPIDFile(CustomPID)
 	}
 
-	createPIDFile(CustomPID)
-
 	if len(CustomConf) == 0 {
 		CustomConf = CustomPath + "/conf/app.ini"
 	}