mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
26 lines
464 B
Go
26 lines
464 B
Go
package conf
|
|
|
|
import (
|
|
"os/exec"
|
|
)
|
|
|
|
type SystemServiceControlMode int
|
|
|
|
const (
|
|
SystemctlMode SystemServiceControlMode = iota
|
|
ServiceMode
|
|
UniversalMode
|
|
)
|
|
|
|
func SetServiceControlMode() (mode SystemServiceControlMode) {
|
|
// The behaviour of this function has changed after v1.1.4
|
|
|
|
if _, err := exec.LookPath("systemctl"); err == nil {
|
|
return SystemctlMode
|
|
}
|
|
if _, err := exec.LookPath("service"); err == nil {
|
|
return ServiceMode
|
|
}
|
|
return UniversalMode
|
|
}
|