1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

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

This commit is contained in:
ssongliu 2023-12-20 15:34:09 +08:00 committed by GitHub
parent 733889407e
commit 411402f9cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}