Files
basics/system/sysctl.go
spiritlhl 7a91e40384 update
2024-07-26 09:24:18 +00:00

26 lines
446 B
Go

package system
import (
"os/exec"
"strings"
)
func checkSysctlVersion(path string) bool {
out, err := exec.Command(path, "-h").Output()
if err != nil {
return false
}
if strings.Contains(string(out), "error") {
return false
}
return true
}
func getSysctlValue(path, key string) (string, error) {
out, err := exec.Command(path, "-n", key).Output()
if err != nil {
return "", err
}
return strings.TrimSpace(string(out)), nil
}