golservice

package
v0.0.0-...-1bfd785 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DaemonPIDFile = flag.String("daemon-pid", "", "path for pidfile of daemon")
	DaemonLogFile = flag.String("daemon-log", "", "path for dumping current status of daemon")
)

Functions

func Daemon

func Daemon(toRun Funk)

full start|stop|status via flag daemon, can just pass service as Funk in main to it

func KillPID

func KillPID(pidFilename string) bool

stop the daemon by killing the PIDs empty param results to "/tmp/<binary-name>.pid"

func LogDaemon

func LogDaemon(msg string)

just logs text to LogFile decided for process daemon

func LogFilename

func LogFilename(filename *string)

return standard path to PIDFile for *nix nodes

func PIDFilename

func PIDFilename(filename *string)

return standard path to PIDFile for *nix nodes

func PersistPID

func PersistPID(pidFilename string) bool

make the current daemon process PIDFile aware in case of servers or so where another instance for same config shall result into error empty param results to "/tmp/<binary-name>.pid"

func ReadPIDFile

func ReadPIDFile(pidFilename string) (int, bool)

returns PID from pidfile and status of the process if stil running

func ServiceName

func ServiceName() string

Get the name of Binary for current running Service

func Start

func Start(toRun Funk)

start for passed Funk typed method call

func Status

func Status()

status for the given process name's stored pid

func StatusPID

func StatusPID(pidFilename string) string

status for stored PID or not empty param results to "/tmp/<binary-name>.pid"

func Stop

func Stop()

stop for the given process name's stored pid

func UpdateFile

func UpdateFile(filename string, filedata string) bool

update given file content with given data

func UpdatePIDFile

func UpdatePIDFile(pidFilename string) bool

updates PID in given pidfile if a daemon allows multiple instances, let it handle PIDFile naming

Types

type Funk

type Funk func()

Jump to

Keyboard shortcuts

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