pidfile

package
v1.6.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean()

Clean cleans up everything created by this package.

func Kill

func Kill(pidfilePath string) (int, error)

Kill opens the pidfile at the specified path, attempts to read the PID and kill the process represented by that PID. If the file doesn't exist, the corresponding process doesn't exist, or the process is successfully killed, reports no error and returns the pid of the killed process (if no process was killed, returns pid 0). Otherwise, returns an error indicating the failure to kill the process.

On success, deletes the pidfile from the filesystem. Otherwise, leaves it in place.

func Remove

func Remove(path string) error

Remove deletes the pidfile at the specified path. This does not clean up the corresponding process, so should only be used when it is known that the PID contained in the file at the specified path is no longer running.

func Write

func Write(path string) error

Write the pid of the process to the specified path, and attach a cleanup handler to the exit of the program so it's removed afterwards.

Types

This section is empty.

Jump to

Keyboard shortcuts

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