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