mirror of
https://github.com/netbirdio/service.git
synced 2026-05-22 17:08:14 -07:00
validate systemctl command
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@@ -22,6 +23,9 @@ func isSystemd() bool {
|
||||
if _, err := os.Stat("/run/systemd/system"); err == nil {
|
||||
return true
|
||||
}
|
||||
if _, err = exec.LookPath("systemctl"); err != nil {
|
||||
return false
|
||||
}
|
||||
if _, err := os.Stat("/proc/1/comm"); err == nil {
|
||||
filerc, err := os.Open("/proc/1/comm")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user