fix: 修改 UFW 防火墙重启方式 (#3402)

pull/3407/head v1.9.2
ssongliu 11 months ago committed by GitHub
parent 733889407e
commit 411402f9cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -65,9 +65,11 @@ func (f *Ufw) Stop() error {
}
func (f *Ufw) Restart() error {
stdout, err := cmd.Execf("%s systemctl restart ufw.service", cmd.SudoHandleCmd())
if err != nil {
return fmt.Errorf("restart the firewall failed, err: %s", stdout)
if err := f.Stop(); err != nil {
return err
}
if err := f.Start(); err != nil {
return err
}
return nil
}

Loading…
Cancel
Save