mirror of
https://github.com/oneclickvirt/basics.git
synced 2025-10-25 09:31:45 +08:00
update
This commit is contained in:
25
system/sysctl.go
Normal file
25
system/sysctl.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func checkSysctlVersion() bool {
|
||||
out, err := exec.Command("sysctl", "--version").Output()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if strings.Contains(string(out), "error") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func getSysctlValue(key string) (string, error) {
|
||||
out, err := exec.Command("sysctl", "-n", key).Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(string(out)), nil
|
||||
}
|
||||
Reference in New Issue
Block a user