mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat: add pidfile
parameter to support OpenRC
This commit is contained in:
parent
c92b31e903
commit
6b40d02b93
7 changed files with 55 additions and 16 deletions
9
main.go
9
main.go
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
"github.com/0xJacky/Nginx-UI/internal/cert"
|
||||
"github.com/0xJacky/Nginx-UI/internal/cmd"
|
||||
"github.com/0xJacky/Nginx-UI/internal/process"
|
||||
|
||||
"code.pfad.fr/risefront"
|
||||
"github.com/0xJacky/Nginx-UI/internal/kernel"
|
||||
|
@ -106,6 +107,14 @@ func main() {
|
|||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
pidPath := appCmd.String("pidfile")
|
||||
if pidPath != "" {
|
||||
if err := process.WritePIDFile(pidPath); err != nil {
|
||||
logger.Fatalf("Failed to write PID file: %v", err)
|
||||
}
|
||||
defer process.RemovePIDFile(pidPath)
|
||||
}
|
||||
|
||||
err := risefront.New(ctx, risefront.Config{
|
||||
Run: Program(ctx, confPath),
|
||||
Name: "nginx-ui",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue