2020-01-29 06:31:06 +05:30
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2020-01-29 06:31:06 +05:30
|
|
|
|
2021-08-24 22:17:09 +05:30
|
|
|
//go:build !windows
|
|
|
|
|
2020-01-29 06:31:06 +05:30
|
|
|
package private
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/graceful"
|
2024-02-27 12:42:22 +05:30
|
|
|
"code.gitea.io/gitea/services/context"
|
2020-01-29 06:31:06 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
// Restart causes the server to perform a graceful restart
|
2021-01-26 21:06:53 +05:30
|
|
|
func Restart(ctx *context.PrivateContext) {
|
2020-01-29 06:31:06 +05:30
|
|
|
graceful.GetManager().DoGracefulRestart()
|
2021-12-15 12:29:57 +05:30
|
|
|
ctx.PlainText(http.StatusOK, "success")
|
2020-01-29 06:31:06 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown causes the server to perform a graceful shutdown
|
2021-01-26 21:06:53 +05:30
|
|
|
func Shutdown(ctx *context.PrivateContext) {
|
2020-01-29 06:31:06 +05:30
|
|
|
graceful.GetManager().DoGracefulShutdown()
|
2021-12-15 12:29:57 +05:30
|
|
|
ctx.PlainText(http.StatusOK, "success")
|
2020-01-29 06:31:06 +05:30
|
|
|
}
|