dd

package module
v0.0.0-...-b4c2b46 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 12 Imported by: 1

README

dd

Daemon服务

功能

  • 使用非常方便
  • 设置后台运行
  • 检查子进程
  • 程序更新检查

使用

package main

import (
	"os"
	"os/signal"
	"time"

	"github.com/ohko/dd"
)

func main() {
	// 启动Daemon
	dd.Daemon(true, true, time.Second*3)

	// 子进程
	// ...

	// 等待结束信号
	c := make(chan os.Signal, 1)
	signal.Notify(c)
	<-c
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(pidFile string) error

func Daemon

func Daemon(pidFile string, daemon, force bool, interval time.Duration)

Daemon 启动守护进程 pid: pid保存文件路径,用于关闭程序 daemon: 后台运行 force: 无论child是否正常退出都重启,否则仅在程序异常退出时才重启 interval: 检查程序更新频率,0=不检查

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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