common

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DatestampFormat = "20060102-1504.05"
)
View Source
var RxSlugProcfileEntry = regexp.MustCompile(`^([a-zA-Z0-9]+):\s*(.+?)\s*$`)
View Source
var (
	RxSshPubKey = regexp.MustCompile(`^(\S+)\s+(\S+)((?:\s*).*)$`)
)

Functions

func Datestamp

func Datestamp() (stamp string)

func DropPrivilegesTo

func DropPrivilegesTo(userName, groupName string) (err error)

func GetIntFromFile

func GetIntFromFile(src string) (v int, err error)

func GetProcessFromPid

func GetProcessFromPid(pid int) (proc *process.Process, err error)

func GetProcessFromPidFile

func GetProcessFromPidFile(pidFile string) (proc *process.Process, err error)

func GetUidGid

func GetUidGid(userName, groupName string) (uid, gid int, err error)

func Gpg

func Gpg(home string, argv ...string) (o, e string, status int, err error)

func GpgShowOnly

func GpgShowOnly(home, file string) (fingerprints []string, err error)

func IsAddressPortOpen

func IsAddressPortOpen(host string, port int) (ok bool)

func IsAddressPortOpenWithTimeout

func IsAddressPortOpenWithTimeout(host string, port int, timeout time.Duration) (ok bool)

func ParseControlArgv

func ParseControlArgv(input string) (argv []string, err error)

func ParseSshKey

func ParseSshKey(input string) (prefix, data, comment, id string, ok bool)

func PerformChmod

func PerformChmod(target string, mode os.FileMode) (err error)

func PerformChown

func PerformChown(target string, uid, gid int) (err error)

func PerformChownChmod

func PerformChownChmod(uid, gid int, fileMode, dirMode os.FileMode, paths ...string) (err error)

func PerformMkdirChownChmod

func PerformMkdirChownChmod(uid, gid int, fileMode, dirMode os.FileMode, directories ...string) (err error)

func ReadProcfile

func ReadProcfile(procfile string) (procTypes map[string]string, err error)

func RepairOwnership

func RepairOwnership(path, userName, groupName string) (err error)

func SendSignalToPidFromFile

func SendSignalToPidFromFile(pidFile string, sig process.Signal) (err error)

func SendSignalToPidTreeFromFile added in v0.1.9

func SendSignalToPidTreeFromFile(pidFile string, sig process.Signal) (err error)

func SetPgrpPriority

func SetPgrpPriority(pid, priority int) (err error)

func SetPidPriority

func SetPidPriority(pid, priority int) (err error)

func UniqueHash

func UniqueHash() (hash string)

Types

type SignalErrors added in v0.1.9

type SignalErrors []error

func NewSignalErrors added in v0.1.9

func NewSignalErrors() (e *SignalErrors)

func SendSignalToPidTree added in v0.1.9

func SendSignalToPidTree(pid int, sig process.Signal) (signalErrors *SignalErrors)

func (*SignalErrors) Append added in v0.1.9

func (e *SignalErrors) Append(errs ...error)

func (*SignalErrors) Error added in v0.1.9

func (e *SignalErrors) Error() (message string)

func (*SignalErrors) Errors added in v0.1.9

func (e *SignalErrors) Errors() []error

func (*SignalErrors) Len added in v0.1.9

func (e *SignalErrors) Len() int

Jump to

Keyboard shortcuts

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