Initial fork commit.
Some checks failed
Release S-UI / build-frontend (push) Failing after 1m53s
Release S-UI / build-386 (push) Has been skipped
Release S-UI / build-amd64 (push) Has been skipped
Release S-UI / build-armv5 (push) Has been skipped
Release S-UI / build-armv6 (push) Has been skipped
Release S-UI / build-armv7 (push) Has been skipped
Release S-UI / build-s390x (push) Has been skipped
Release S-UI / build-arm64 (push) Has been skipped
Build S-UI for Windows / build-frontend (push) Failing after 2s
Build S-UI for Windows / build-windows-amd64 (push) Has been skipped
Build S-UI for Windows / build-windows-arm64 (push) Has been skipped
Some checks failed
Release S-UI / build-frontend (push) Failing after 1m53s
Release S-UI / build-386 (push) Has been skipped
Release S-UI / build-amd64 (push) Has been skipped
Release S-UI / build-armv5 (push) Has been skipped
Release S-UI / build-armv6 (push) Has been skipped
Release S-UI / build-armv7 (push) Has been skipped
Release S-UI / build-s390x (push) Has been skipped
Release S-UI / build-arm64 (push) Has been skipped
Build S-UI for Windows / build-frontend (push) Failing after 2s
Build S-UI for Windows / build-windows-amd64 (push) Has been skipped
Build S-UI for Windows / build-windows-arm64 (push) Has been skipped
Signed-off-by: Pavel Kirilin <s3riussan@gmail.com>
This commit is contained in:
32
service/panel.go
Normal file
32
service/panel.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"os"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/alireza0/s-ui/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)
|
||||
if runtime.GOOS == "windows" {
|
||||
err = p.Kill()
|
||||
} else {
|
||||
err = p.Signal(syscall.SIGHUP)
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("send signal SIGHUP failed:", err)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user