This package provides structure and helper functions to create and remove PID file. PIDFile is a file used to store the process ID of a running process.
For more information and documents, visit https://godoc.org/github.com/mingcheng/pidfile.go
- Support on muti-system (Linux, macOS, Windows and FreeBSD)
- With all full tested
To usage this package is simple, here is an example:
import "github.com/mingcheng/pidfile"
var pidFilePath = "/var/run/my.pid"
if pid, err := pidfile.New(pidFilePath); err != nil {
log.Panic(err)
} else {
fmt.Println(pid)
defer pid.Remove()
}
If you have any suggest, sending me via email to echo bWluZ2NoZW5nQG91dGxvb2suY29tCg== | base64 -D
, with huge thanks.
- eof -