code.gitea.io/gitea@v1.21.7/routers/private/manager_unix.go (about)

     1  // Copyright 2020 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  //go:build !windows
     5  
     6  package private
     7  
     8  import (
     9  	"net/http"
    10  
    11  	"code.gitea.io/gitea/modules/context"
    12  	"code.gitea.io/gitea/modules/graceful"
    13  )
    14  
    15  // Restart causes the server to perform a graceful restart
    16  func Restart(ctx *context.PrivateContext) {
    17  	graceful.GetManager().DoGracefulRestart()
    18  	ctx.PlainText(http.StatusOK, "success")
    19  }
    20  
    21  // Shutdown causes the server to perform a graceful shutdown
    22  func Shutdown(ctx *context.PrivateContext) {
    23  	graceful.GetManager().DoGracefulShutdown()
    24  	ctx.PlainText(http.StatusOK, "success")
    25  }