2020-01-28 18:01:06 -07: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 13:38:49 -07:00
|
|
|
//go:build !windows
|
|
|
|
// +build !windows
|
|
|
|
|
2020-01-28 18:01:06 -07:00
|
|
|
package private
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2021-01-26 08:36:53 -07:00
|
|
|
"code.gitea.io/gitea/modules/context"
|
2020-01-28 18:01:06 -07:00
|
|
|
"code.gitea.io/gitea/modules/graceful"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Restart causes the server to perform a graceful restart
|
2021-01-26 08:36:53 -07:00
|
|
|
func Restart(ctx *context.PrivateContext) {
|
2020-01-28 18:01:06 -07:00
|
|
|
graceful.GetManager().DoGracefulRestart()
|
|
|
|
ctx.PlainText(http.StatusOK, []byte("success"))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown causes the server to perform a graceful shutdown
|
2021-01-26 08:36:53 -07:00
|
|
|
func Shutdown(ctx *context.PrivateContext) {
|
2020-01-28 18:01:06 -07:00
|
|
|
graceful.GetManager().DoGracefulShutdown()
|
|
|
|
ctx.PlainText(http.StatusOK, []byte("success"))
|
|
|
|
}
|