2020-01-29 02:01:06 +01:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2021-11-16 21:38:49 +01:00
|
|
|
//go:build windows
|
|
|
|
// +build windows
|
|
|
|
|
2020-01-29 02:01:06 +01:00
|
|
|
package private
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2021-01-26 16:36:53 +01:00
|
|
|
"code.gitea.io/gitea/modules/context"
|
2020-01-29 02:01:06 +01:00
|
|
|
"code.gitea.io/gitea/modules/graceful"
|
2021-06-23 21:38:19 +02:00
|
|
|
"code.gitea.io/gitea/modules/private"
|
2020-01-29 02:01:06 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Restart is not implemented for Windows based servers as they can't fork
|
2021-01-26 16:36:53 +01:00
|
|
|
func Restart(ctx *context.PrivateContext) {
|
2021-06-23 21:38:19 +02:00
|
|
|
ctx.JSON(http.StatusNotImplemented, private.Response{
|
|
|
|
Err: "windows servers cannot be gracefully restarted - shutdown and restart manually",
|
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()
|
|
|
|
ctx.PlainText(http.StatusOK, []byte("success"))
|
|
|
|
}
|