Add -pidfile and Commit variable
This commit is contained in:
parent
8d6b33342d
commit
3a43042089
|
@ -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 fConfig = flag.String("config", "", "configuration file to load")
|
||||||
var fVersion = flag.Bool("version", false, "display the version")
|
var fVersion = flag.Bool("version", false, "display the version")
|
||||||
var fSampleConfig = flag.Bool("sample-config", false, "print out full sample configuration")
|
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 Version = "unreleased"
|
||||||
|
var Commit = ""
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -104,5 +106,16 @@ func main() {
|
||||||
log.Printf("Tags enabled: %v", config.ListTags())
|
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)
|
ag.Run(shutdown)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue