2020-01-29 01:01:06 +00:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 13:20:29 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-01-29 01:01:06 +00:00
|
|
|
|
|
|
|
package private
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2025-03-27 19:40:14 +00:00
|
|
|
"forgejo.org/modules/graceful"
|
|
|
|
"forgejo.org/services/context"
|
2020-01-29 01:01:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Restart causes the server to perform a graceful restart
|
2021-01-26 23:36:53 +08:00
|
|
|
func Restart(ctx *context.PrivateContext) {
|
2020-01-29 01:01:06 +00:00
|
|
|
graceful.GetManager().DoGracefulRestart()
|
2021-12-15 14:59:57 +08:00
|
|
|
ctx.PlainText(http.StatusOK, "success")
|
2020-01-29 01:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown causes the server to perform a graceful shutdown
|
2021-01-26 23:36:53 +08:00
|
|
|
func Shutdown(ctx *context.PrivateContext) {
|
2020-01-29 01:01:06 +00:00
|
|
|
graceful.GetManager().DoGracefulShutdown()
|
2021-12-15 14:59:57 +08:00
|
|
|
ctx.PlainText(http.StatusOK, "success")
|
2020-01-29 01:01:06 +00:00
|
|
|
}
|