pidfile

package
v5.9.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

README

pidfile

golang package for create and clear pid file.

Documentation

Index

Constants

View Source
const (
	PID_FILE_MIN_ID          = 0
	PID_FILE_TMP_PATH_SUFFIX = ".tmp"
)

Variables

This section is empty.

Functions

func ClearPidFile

func ClearPidFile(pf *PidFile) error

Types

type File

type File struct {
	Path string
}

func NewFile

func NewFile(path string) *File

func (*File) Read

func (f *File) Read() ([]byte, error)

func (*File) Remove

func (f *File) Remove() error

func (*File) Rename

func (f *File) Rename(newFile string) error

func (*File) Write

func (f *File) Write(data []byte) error

type Pid

type Pid struct {
	Id int
}

func NewPid

func NewPid(id int) *Pid

func (*Pid) ProcessExist

func (p *Pid) ProcessExist() bool

type PidFile

type PidFile struct {
	Pid     *Pid
	File    *File
	TmpFile *File
}

func CreatePidFile

func CreatePidFile(path string) (*PidFile, error)

func NewPidFile

func NewPidFile(path string) *PidFile

func (*PidFile) Clear

func (pf *PidFile) Clear() error

func (*PidFile) Create

func (pf *PidFile) Create() error

func (*PidFile) ReadPidFromFile

func (pf *PidFile) ReadPidFromFile(file *File) (*Pid, error)

func (*PidFile) WritePidToFile

func (pf *PidFile) WritePidToFile(file *File, pid *Pid) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL