守护进程
与Go(golang)服务一起使用的守护程序包
例子
最简单的示例(只需将self安装为守护程序)
package main
import (
"fmt"
"log"
"github.com/takama/daemon"
)
func main () {
service , err := daemon . New ( "name" , "description" , daemon . SystemDaemon )
if err != nil {
log . Fatal ( "Error: " , err )
}
status , err := service . Install ()
if err != nil {
log . Fatal ( status , " \n Error: " , err )
}
fmt . Println ( status )
}
真实的例子
// Example of a daemon with echo service
packa
1