2020-01-29 10:01:06 +09:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-28 03:20:29 +09:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-01-29 10:01:06 +09:00
|
|
|
|
2021-08-25 01:47:09 +09:00
|
|
|
//go:build windows
|
|
|
|
|
2020-01-29 10:01:06 +09:00
|
|
|
package private
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2021-01-27 00:36:53 +09:00
|
|
|
"code.gitea.io/gitea/modules/context"
|
2020-01-29 10:01:06 +09:00
|
|
|
"code.gitea.io/gitea/modules/graceful"
|
2021-06-24 04:38:19 +09:00
|
|
|
"code.gitea.io/gitea/modules/private"
|
2020-01-29 10:01:06 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
// Restart is not implemented for Windows based servers as they can't fork
|
2021-01-27 00:36:53 +09:00
|
|
|
func Restart(ctx *context.PrivateContext) {
|
2021-06-24 04:38:19 +09:00
|
|
|
ctx.JSON(http.StatusNotImplemented, private.Response{
|
|
|
|
Err: "windows servers cannot be gracefully restarted - shutdown and restart manually",
|
2020-01-29 10:01:06 +09:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown causes the server to perform a graceful shutdown
|
2021-01-27 00:36:53 +09:00
|
|
|
func Shutdown(ctx *context.PrivateContext) {
|
2020-01-29 10:01:06 +09:00
|
|
|
graceful.GetManager().DoGracefulShutdown()
|
2021-12-15 15:59:57 +09:00
|
|
|
ctx.PlainText(http.StatusOK, "success")
|
2020-01-29 10:01:06 +09:00
|
|
|
}
|