github.com/go-graphite/carbonapi@v0.17.0/util/pidfile/pidfile.go (about) 1 package pidfile 2 3 import ( 4 "os" 5 "strconv" 6 "strings" 7 8 "github.com/natefinch/atomic" 9 ) 10 11 func WritePidFile(path string) error { 12 pid := strconv.Itoa(os.Getpid()) 13 myReader := strings.NewReader(pid) 14 return atomic.WriteFile(path, myReader) 15 }