pid

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package pid manages PID files for Podplane background processes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PIDFile

type PIDFile struct {
	// contains filtered or unexported fields
}

PIDFile represents a process PID file

func Init

func Init(opts PIDOptions) (PIDFile, error)

Init checks if a PID file exists on disk, and if so unmarshals the PID file into the PIDFile struct, or otherwises returns an empty PIDFile

func (*PIDFile) Clean

func (p *PIDFile) Clean() error

Clean removes the PID file if it exists

func (*PIDFile) ClearData

func (p *PIDFile) ClearData()

ClearData clears the data map

func (*PIDFile) FilePath

func (p *PIDFile) FilePath() string

FilePath returns the path to the PID file

func (*PIDFile) GetData

func (p *PIDFile) GetData(key string) string

GetData returns the value of the specified key from the data map

func (*PIDFile) IsRunning

func (p *PIDFile) IsRunning() (bool, error)

IsRunning checks if the PID file is running

func (*PIDFile) Kill

func (p *PIDFile) Kill() error

Kill stops an existing PIDFile process

func (*PIDFile) PID

func (p *PIDFile) PID() int

PID returns the process id

func (*PIDFile) SetData

func (p *PIDFile) SetData(key, value string)

SetData sets the value of the specified key in the data map

func (*PIDFile) SetPID

func (p *PIDFile) SetPID(pid int) error

SetPID sets the process id

func (*PIDFile) Write

func (p *PIDFile) Write() error

Write marshal's the PIDFile struct and writes it to the PID file

type PIDFileData

type PIDFileData struct {
	PID  int               `json:"pid"`
	Data map[string]string `json:"data"`
}

PIDFileData represents the data structure of the PID file

type PIDOptions

type PIDOptions struct {
	Directory string
	Filename  string
}

PIDOptions holds config

Jump to

Keyboard shortcuts

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