xdaemon

package
v0.25.15 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

GoKit - xdaemon

Daemon kits for Golang development.

Installation

go get -u github.com/likexian/gokit

Importing

import (
    "github.com/likexian/gokit/xdaemon"
)

Documentation

Visit the docs on GoDoc

Example

Do deamon
c := xdaemon.Config {
    Pid:   "/tmp/test.pid", // the pid file name
    Log:   "/tmp/test.log", // the log file name
    User:  "nobody",        // run daemon as user, if set, ROOT is required
    Chdir: "/",             // change working dir
}

err := c.Daemon()
if err != nil {
    panic(err)
}

License

Copyright 2012-2024 Li Kexian

Licensed under the Apache License 2.0

Donation

If this project is helpful, please share it with friends.

If you want to thank me, you can give me a cup of coffee.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Author

func Author() string

Author returns package author

func License

func License() string

License returns package license

func Version

func Version() string

Version returns package version

Types

type Config

type Config struct {
	Pid   string
	Log   string
	User  string
	Chdir string
}

Config storing config for daemon

func (*Config) Daemon

func (c *Config) Daemon() (err error)

Daemon start to daemon

Jump to

Keyboard shortcuts

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