mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-11 04:46:12 +08:00
fix: Add iptables execution timeout
This commit is contained in:
parent
5d2084fda4
commit
a1adfe1737
1 changed files with 2 additions and 2 deletions
|
|
@ -44,7 +44,7 @@ const (
|
|||
)
|
||||
|
||||
func RunWithStd(tab, rule string) (string, error) {
|
||||
cmdMgr := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(20*time.Second))
|
||||
cmdMgr := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(60*time.Second))
|
||||
stdout, err := cmdMgr.RunWithStdoutBashCf("%s iptables -w -t %s %s", cmd.SudoHandleCmd(), tab, rule)
|
||||
if err != nil {
|
||||
global.LOG.Errorf("iptables command failed [table=%s, rule=%s]: %v", tab, rule, err)
|
||||
|
|
@ -53,7 +53,7 @@ func RunWithStd(tab, rule string) (string, error) {
|
|||
return stdout, nil
|
||||
}
|
||||
func RunWithoutIgnore(tab, rule string) (string, error) {
|
||||
cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(20 * time.Second))
|
||||
cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(60 * time.Second))
|
||||
stdout, err := cmdMgr.RunWithStdoutBashCf("%s iptables -t %s %s", cmd.SudoHandleCmd(), tab, rule)
|
||||
if err != nil {
|
||||
return stdout, err
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue