gitea源码

manager_windows.go 739B

12345678910111213141516171819202122232425262728
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. //go:build windows
  4. package private
  5. import (
  6. "net/http"
  7. "code.gitea.io/gitea/modules/graceful"
  8. "code.gitea.io/gitea/modules/private"
  9. "code.gitea.io/gitea/services/context"
  10. )
  11. // Restart is not implemented for Windows based servers as they can't fork
  12. func Restart(ctx *context.PrivateContext) {
  13. ctx.JSON(http.StatusNotImplemented, private.Response{
  14. UserMsg: "windows servers cannot be gracefully restarted - shutdown and restart manually",
  15. })
  16. }
  17. // Shutdown causes the server to perform a graceful shutdown
  18. func Shutdown(ctx *context.PrivateContext) {
  19. graceful.GetManager().DoGracefulShutdown()
  20. ctx.PlainText(http.StatusOK, "success")
  21. }