You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

windows-service.en-us.md 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ---
  2. date: "2016-12-21T15:00:00-02:00"
  3. title: "Register as a Windows Service"
  4. slug: "windows-service"
  5. sidebar_position: 50
  6. toc: false
  7. draft: false
  8. aliases:
  9. - /en-us/windows-service
  10. menu:
  11. sidebar:
  12. parent: "installation"
  13. name: "Windows Service"
  14. sidebar_position: 50
  15. identifier: "windows-service"
  16. ---
  17. # Prerequisites
  18. The following changes are made in C:\gitea\custom\conf\app.ini:
  19. ```
  20. RUN_USER = COMPUTERNAME$
  21. ```
  22. Sets Gitea to run as the local system user.
  23. COMPUTERNAME is whatever the response is from `echo %COMPUTERNAME%` on the command line. If the response is `USER-PC` then `RUN_USER = USER-PC$`
  24. ## Use absolute paths
  25. If you use SQLite3, change the `PATH` to include the full path:
  26. ```
  27. [database]
  28. PATH = c:/gitea/data/gitea.db
  29. ```
  30. # Register as a Windows Service
  31. To register Gitea as a Windows service, open a command prompt (cmd) as an Administrator,
  32. then run the following command:
  33. ```
  34. sc.exe create gitea start= auto binPath= "\"C:\gitea\gitea.exe\" web --config \"C:\gitea\custom\conf\app.ini\""
  35. ```
  36. Do not forget to replace `C:\gitea` with the correct Gitea directory.
  37. Open "Windows Services", search for the service named "gitea", right-click it and click on
  38. "Run". If everything is OK, Gitea will be reachable on `http://localhost:3000` (or the port
  39. that was configured).
  40. ## Adding startup dependencies
  41. To add a startup dependency to the Gitea Windows service (eg Mysql, Mariadb), as an Administrator, then run the following command:
  42. ```
  43. sc.exe config gitea depend= mariadb
  44. ```
  45. This will ensure that when the Windows machine restarts, the automatic starting of Gitea is postponed until the database is ready and thus mitigate failed startups.
  46. ## Unregister as a service
  47. To unregister Gitea as a service, open a command prompt (cmd) as an Administrator and run:
  48. ```
  49. sc.exe delete gitea
  50. ```