Skip to content

HellGuardian/daemon-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

daemon.go

daemon-go is a Go module for doing daemon.

Build Status

Overview

A perfect golang module for doing daemon.

*Work for nix ONLY

Installation

go get github.com/likexian/daemon-go

Importing

import (
    "github.com/likexian/daemon-go"
)

Documentation

type Config

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

Do daemon

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

Example

c := daemon.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 2015-2016, Li Kexian

Apache License, Version 2.0

About

About

Go module for doing daemon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%