mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
enhance(upgrader): restart main proc manually and gracefully
This commit is contained in:
parent
31bbab71c9
commit
e72e8cef57
3 changed files with 7 additions and 12 deletions
13
main.go
13
main.go
|
@ -6,14 +6,12 @@ import (
|
|||
"github.com/0xJacky/Nginx-UI/internal/kernal"
|
||||
"github.com/0xJacky/Nginx-UI/internal/logger"
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
"github.com/0xJacky/Nginx-UI/internal/upgrader"
|
||||
"github.com/0xJacky/Nginx-UI/router"
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jpillora/overseer"
|
||||
"github.com/jpillora/overseer/fetcher"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Program(state overseer.State) {
|
||||
|
@ -42,16 +40,9 @@ func main() {
|
|||
|
||||
gin.SetMode(settings.ServerSettings.RunMode)
|
||||
|
||||
r, err := upgrader.GetRuntimeInfo()
|
||||
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
overseer.Run(overseer.Config{
|
||||
Program: Program,
|
||||
Address: fmt.Sprintf("%s:%s", settings.ServerSettings.HttpHost, settings.ServerSettings.HttpPort),
|
||||
Fetcher: &fetcher.File{Path: r.ExPath},
|
||||
TerminateTimeout: 0,
|
||||
TerminateTimeout: 5 * time.Second,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue