forked from takama/daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaemon_linux.go
More file actions
27 lines (23 loc) · 806 Bytes
/
daemon_linux.go
File metadata and controls
27 lines (23 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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")
// }