@@ -25,6 +25,7 @@ import (
25
25
"github.com/dgryski/go-expirecache"
26
26
"github.com/dgryski/httputil"
27
27
"github.com/facebookgo/grace/gracehttp"
28
+ "github.com/facebookgo/pidfile"
28
29
pickle "github.com/kisielk/og-rek"
29
30
"github.com/peterbourgon/g2g"
30
31
)
@@ -655,6 +656,7 @@ func main() {
655
656
logtostdout := flag .Bool ("stdout" , false , "write logging output also to stdout" )
656
657
logdir := flag .String ("logdir" , "/var/log/carbonzipper/" , "logging directory" )
657
658
interval := flag .Duration ("i" , 0 , "interval to report internal statistics to graphite" )
659
+ pidFile := flag .String ("pid" , "" , "pidfile (default: empty, don't create pidfile)" )
658
660
659
661
flag .Parse ()
660
662
@@ -792,6 +794,14 @@ func main() {
792
794
793
795
go Config .pathCache .ec .ApproximateCleaner (10 * time .Second )
794
796
797
+ if * pidFile != "" {
798
+ pidfile .SetPidfilePath (* pidFile )
799
+ err = pidfile .Write ()
800
+ if err != nil {
801
+ log .Fatalln ("error during pidfile.Write():" , err )
802
+ }
803
+ }
804
+
795
805
portStr := fmt .Sprintf (":%d" , Config .Port )
796
806
logger .Logln ("listening on" , portStr )
797
807
0 commit comments