pidfile

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPath

func GetPath() string

GetPath returns the current pidfile path.

func OwnerPid

func OwnerPid() (int, error)

OwnerPid returns the ID of the process owning the PID file. 0 is returned if it is known that no process owns the file. -1 and an error is returned if the owner or its existence could not be determined.

func Read

func Read() (int, error)

Read reads the content of the PID file. It returns the process ID found in the file. If opening the file or reading an integer process ID fails Read() returns -1 and an error.

func Remove

func Remove() error

Remove removes the PID file for the process unconditionally, regardless if the current process had created the PID file or not.

func SetPath

func SetPath(path string)

SetPath sets the pidfile path to the given one.

func Write

func Write() error

Write opens the PID file and writes os.Getpid() to it. If the PID file already exists Write() fails with an error. On successful completion, Write keeps the PID file open.

Types

This section is empty.

Jump to

Keyboard shortcuts

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