feat: create standalone native fnOS repository

This commit is contained in:
2026-10-02 15:19:09 +08:00
parent 69f3c30fab
commit 6725fc131d
492 changed files with 94023 additions and 3 deletions
+32
View File
@@ -0,0 +1,32 @@
//go:build !windows
package nginx
import (
"context"
"os/exec"
"syscall"
"time"
)
func prepareStartPlatform(m *Manager, ctx context.Context) {
stopOrphanMasters(ctx, m)
}
func stopOrphanMasters(ctx context.Context, m *Manager) {
pid, err := readPIDFile(m.cfg.NginxPIDFile)
if err == nil && isPIDAlive(pid) {
_ = terminateProcess(pid, syscall.SIGTERM)
waitProcessExit(pid, nginxTerminateWait)
if isPIDAlive(pid) {
_ = terminateProcess(pid, syscall.SIGKILL)
waitProcessExit(pid, time.Second)
}
}
_ = m.runNginx(ctx, []string{"-c", m.cfg.NginxConfigPath(), "-s", "quit"}, "")
removePIDFile(m.cfg.NginxPIDFile)
if _, err := exec.LookPath("pkill"); err == nil {
_ = exec.Command("pkill", "-x", "nginx").Run()
time.Sleep(200 * time.Millisecond)
}
}