Add -pidfile and Commit variable

This commit is contained in:
Evan Phoenix 2015-06-18 11:31:16 -07:00
parent 8d6b33342d
commit 3a43042089
1 changed files with 13 additions and 0 deletions

View File

@ -17,8 +17,10 @@ var fTest = flag.Bool("test", false, "gather metrics, print them out, and exit")
var fConfig = flag.String("config", "", "configuration file to load")
var fVersion = flag.Bool("version", false, "display the version")
var fSampleConfig = flag.Bool("sample-config", false, "print out full sample configuration")
var fPidfile = flag.String("pidfile", "", "file to write our pid to")
var Version = "unreleased"
var Commit = ""
func main() {
flag.Parse()
@ -104,5 +106,16 @@ func main() {
log.Printf("Tags enabled: %v", config.ListTags())
}
if *fPidfile != "" {
f, err := os.Create(*fPidfile)
if err != nil {
log.Fatalf("Unable to create pidfile: %s", err)
}
fmt.Fprintf(f, "%d\n", os.Getpid())
f.Close()
}
ag.Run(shutdown)
}