centos 6 使用go github.com/kardianos/service 时 无法自动启动
在文件 github.com/kardianos/service/service_linux.go 中
查找 ChooseSystem
将第二个 isUpstart 注释
即为
func init() {
ChooseSystem(linuxSystemService{
name: "linux-systemd",
detect: isSystemd,
interactive: func() bool {
is, _ := isInteractive()
return is
},
new: newSystemdService,
},
//linuxSystemService{
// name: "linux-upstart",
// detect: isUpstart,
// interactive: func() bool {
// is, _ := isInteractive()
// return is
// },
// new: newUpstartService,
//}, // 去掉这个
linuxSystemService{
name: "unix-systemv",
detect: func() bool { return true },
interactive: func() bool {
is, _ := isInteractive()
return is
},
new: newSystemVService,
},
)
}