X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b2d825bd6059d843b1ae1917ff22e4de3cfc4f5a..dd481ab3359f1b360a22d03c09d8035ef5db1f38:/services/crunchstat/crunchstat.go diff --git a/services/crunchstat/crunchstat.go b/services/crunchstat/crunchstat.go index cd84770e54..ad433bb3b5 100644 --- a/services/crunchstat/crunchstat.go +++ b/services/crunchstat/crunchstat.go @@ -7,6 +7,7 @@ package main import ( "bufio" "flag" + "fmt" "io" "log" "os" @@ -23,6 +24,7 @@ const MaxLogLine = 1 << 14 // Child stderr lines >16KiB will be split var ( signalOnDeadPPID int = 15 ppidCheckInterval = time.Second + version = "dev" ) func main() { @@ -36,9 +38,18 @@ func main() { flag.IntVar(&signalOnDeadPPID, "signal-on-dead-ppid", signalOnDeadPPID, "Signal to send child if crunchstat's parent process disappears (0 to disable)") flag.DurationVar(&ppidCheckInterval, "ppid-check-interval", ppidCheckInterval, "Time between checks for parent process disappearance") pollMsec := flag.Int64("poll", 1000, "Reporting interval, in milliseconds") + getVersion := flag.Bool("version", false, "Print version information and exit.") flag.Parse() + // Print version information if requested + if *getVersion { + fmt.Printf("crunchstat %s\n", version) + return + } + + reporter.Logger.Printf("crunchstat %s started", version) + if reporter.CgroupRoot == "" { reporter.Logger.Fatal("error: must provide -cgroup-root") } else if signalOnDeadPPID < 0 {