2 Star 2 Fork 8

王布衣/gox

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
daemon_linux.go 797 Bytes
Copy Edit Raw Blame History
王布衣 authored 2023-07-20 08:32 +08:00 . 新增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")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/gox.git
git@gitee.com:quant1x/gox.git
quant1x
gox
gox
v1.24.9

Search