summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitzunu <24550914+Kitzunu@users.noreply.github.com>2021-08-25 00:09:44 +0200
committerGitHub <noreply@github.com>2021-08-25 00:09:44 +0200
commitfbe1b9425f9efcc305b74628a8d1e440004cc39a (patch)
tree63912cbc1fcc4a4da3873e5bd44eac53ba7fcedf
parent643b7368aa0f06bfa3cfbb2c60f16da060cd5c00 (diff)
downloadwiki-fbe1b9425f9efcc305b74628a8d1e440004cc39a.tar.gz
wiki-fbe1b9425f9efcc305b74628a8d1e440004cc39a.tar.bz2
wiki-fbe1b9425f9efcc305b74628a8d1e440004cc39a.zip
chore: Explain exit codes (#627)
* chore: explain exit codes * Update documentation-index.md * Update exitcodes.md * Update exitcodes.md
-rw-r--r--docs/documentation-index.md1
-rw-r--r--docs/exitcodes.md43
2 files changed, 44 insertions, 0 deletions
diff --git a/docs/documentation-index.md b/docs/documentation-index.md
index c245742..059bacc 100644
--- a/docs/documentation-index.md
+++ b/docs/documentation-index.md
@@ -21,6 +21,7 @@ redirect_from: /documentation_index
* [Clang Format](clang-format)
* [CMake options](cmake-options.md)
* [Directory structure](directory-structure.md)
+* [Exit Codes](exitcodes.md)
* [How to Debug and Restart](how-to-restart-and-debug.md)
* [IP2LOCATION](ip2location.md)
* [Logging Configuration](logging-configuration.md)
diff --git a/docs/exitcodes.md b/docs/exitcodes.md
new file mode 100644
index 0000000..08eebf3
--- /dev/null
+++ b/docs/exitcodes.md
@@ -0,0 +1,43 @@
+# Exit Codes
+
+AzerothCore has 3 default exit codes that are called if you shutdown, restart or crash the server.
+
+```cpp
+enum ShutdownExitCode
+{
+ SHUTDOWN_EXIT_CODE = 0,
+ ERROR_EXIT_CODE = 1,
+ RESTART_EXIT_CODE = 2,
+};
+```
+
+SHUTDOWN_EXIT_CODE is called when you use the commands **.server shutdown**, **.server idleshutdown**, **.server exit** or if the [m_serviceStatus == 0](https://github.com/azerothcore/azerothcore-wotlk/blob/a594bf5b290e5476c61bab29809a079e93c5daa2/src/server/worldserver/Main.cpp#L575-L581) for Windows.
+
+RESTART_EXIT_CODE is called when you use the commands **..server restart** and **.server idlerestart**.
+
+ERROR_EXIT_CODE is called when the server crashes. This can be due to due to guid/id/entry overflow, [Network.Threads](https://github.com/azerothcore/azerothcore-wotlk/blob/a594bf5b290e5476c61bab29809a079e93c5daa2/src/server/worldserver/worldserver.conf.dist#L2909-L2913) being <= 0 or if the server cannot initialize network.
+
+The best way to know where all the exit codes are called is by finding them in the source code.
+
+## Commands
+
+```
+.server idleshutdown #delay [#exit_code]
+.server idlerestart #delay [#exit_code]
+.server shutdown #delay [#exit_code]
+.server restart #delay [#exit_code]
+```
+
+The `.server shutdown/restart`, `.server idleshutdown/restart` commands all have an argument for **[#exit_code]**.
+
+The default exit code for shutdown is always 0 and the default exit code for restart is always 2 if the argument is left blank.
+
+The argument can take a value between 0 - 125 which lets you output a custom exit code other than the defaults.
+
+## Scripts including exit codes
+
+Having the Worldserver sending exit codes let's you create an external script that can act when it reads a specific exit code being displayed.
+
+For example it's possible to write a script to automatically restart if the Worldserver sends RESTART_EXIT_CODE.
+
+You can view [this](https://github.com/Kitzunu/azerothcore-exitcode-script) batch script for Windows how exit codes can be used.