mirror of https://github.com/1Panel-dev/1Panel
parent
6dbb6d2247
commit
7c46f54e15
|
@ -25,7 +25,7 @@ func (f *Firewall) Name() string {
|
|||
}
|
||||
|
||||
func (f *Firewall) Status() (string, error) {
|
||||
stdout, _ := cmd.Exec("firewall-cmd --state")
|
||||
stdout, _ := cmd.Exec("LANGUAGE=en_US:en firewall-cmd --state")
|
||||
if stdout == "running\n" {
|
||||
return "running", nil
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func (f *Firewall) Status() (string, error) {
|
|||
}
|
||||
|
||||
func (f *Firewall) Version() (string, error) {
|
||||
stdout, err := cmd.Exec("firewall-cmd --version")
|
||||
stdout, err := cmd.Exec("LANGUAGE=en_US:en firewall-cmd --version")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("load the firewall version failed, err: %s", stdout)
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ type Ufw struct {
|
|||
func NewUfw() (*Ufw, error) {
|
||||
var ufw Ufw
|
||||
if cmd.HasNoPasswordSudo() {
|
||||
ufw.CmdStr = "sudo ufw"
|
||||
ufw.CmdStr = "LANGUAGE=en_US:en sudo ufw"
|
||||
} else {
|
||||
ufw.CmdStr = "ufw"
|
||||
ufw.CmdStr = "LANGUAGE=en_US:en ufw"
|
||||
}
|
||||
return &ufw, nil
|
||||
}
|
||||
|
@ -33,10 +33,6 @@ func (f *Ufw) Status() (string, error) {
|
|||
if stdout == "Status: active\n" {
|
||||
return "running", nil
|
||||
}
|
||||
stdout1, _ := cmd.Execf("%s status | grep 状态", f.CmdStr)
|
||||
if stdout1 == "状态: 激活\n" {
|
||||
return "running", nil
|
||||
}
|
||||
return "not running", nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue