3x-ui/web/service/panel.go
mhsanaei 7447cec17e
Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run
go package correction v2
2025-09-19 10:05:43 +02:00

26 lines
426 B
Go

package service
import (
"os"
"syscall"
"time"
"github.com/mhsanaei/3x-ui/v2/logger"
)
type PanelService struct{}
func (s *PanelService) RestartPanel(delay time.Duration) error {
p, err := os.FindProcess(syscall.Getpid())
if err != nil {
return err
}
go func() {
time.Sleep(delay)
err := p.Signal(syscall.SIGHUP)
if err != nil {
logger.Error("failed to send SIGHUP signal:", err)
}
}()
return nil
}