2 Star 2 Fork 8

王布衣/gox

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
daemon_linux.go 797 Bytes
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-07-20 08:32 . 新增daemon工具库
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by
// license that can be found in the LICENSE file.
// Package daemon linux version
package daemon
import (
"os"
)
// Get the daemon properly
func newDaemon(name, description string, kind Kind, dependencies []string) (Daemon, error) {
// newer subsystem must be checked first
if _, err := os.Stat("/run/systemd/system"); err == nil {
return &systemDRecord{name, description, kind, dependencies}, nil
}
if _, err := os.Stat("/sbin/initctl"); err == nil {
return &upstartRecord{name, description, kind, dependencies}, nil
}
return &systemVRecord{name, description, kind, dependencies}, nil
}
// Get executable path
func execPath() (string, error) {
return os.Readlink("/proc/self/exe")
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/gox.git
git@gitee.com:quant1x/gox.git
quant1x
gox
gox
v1.16.2

搜索帮助