Difference between revisions of "Manual:DIL Manual/reboot"
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = reboot = | |
| + | '''Procedure.''' Shuts the game server down. | ||
| − | + | reboot(code : integer) | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | The server stops after the current pass of its game loop: the players who are connected are saved and their connections closed, and vme exits with <code>code</code> as its exit status. Whether the game comes back depends on what started vme: a script or service manager that starts it again turns this into a reboot. | |
| − | |||
| − | |||
| − | + | Only a program started in a zone with access level 0 (the fourth column of <code>vme/etc/zonelist</code>) can use it. What counts is the zone of the program's first template, the one that was <code>dilcopy</code>'d or run as a command. Elsewhere the zone log gets "attempt to violate system access security (reboot)" and the program stops. | |
| − | + | == Parameters == | |
| − | + | {| class="wikitable" | |
| + | ! Name !! Type !! Meaning | ||
| + | |- | ||
| + | | code || integer || vme's exit status. 0 means all is well; the DIL integration tests (test.zon) exit with the number of a failed test, so the test script sees the failure. | ||
| + | |} | ||
| − | + | == Notes == | |
| − | + | * The argument is required: <code>reboot;</code> is a syntax error. | |
| − | + | * The program goes on after <code>reboot()</code> until it waits or quits, and the rest of the current game loop pass runs too. End with <code>quit</code>. | |
| − | + | * It warns nobody. The <code>reboot</code> command (<code>cmd_reboot</code> and <code>rebooting</code> in commands.zon) counts down and tells the players first. | |
| − | |||
| − | |||
| − | |||
| − | + | == Example == | |
| − | + | <pre> | |
| + | dilbegin failsafe(); | ||
| + | code | ||
| + | { | ||
| + | heartbeat := PULSE_SEC * 60 * 5; | ||
| + | wait(SFB_TICK, TRUE); | ||
| + | log("Fail safe triggered"); | ||
| + | reboot(99); | ||
| + | quit; | ||
| + | } | ||
dilend | dilend | ||
| + | </pre> | ||
| + | Stops the server with exit status 99 after five minutes, as the integration tests in test.zon do when a test hangs. | ||
| − | + | == See also == | |
| − | + | * [[Manual:DIL Manual/quit|quit]] | |
| − | + | * [[Manual:DIL Manual/access|access]] | |
Latest revision as of 23:16, 14 November 2026
reboot
Procedure. Shuts the game server down.
reboot(code : integer)
The server stops after the current pass of its game loop: the players who are connected are saved and their connections closed, and vme exits with code as its exit status. Whether the game comes back depends on what started vme: a script or service manager that starts it again turns this into a reboot.
Only a program started in a zone with access level 0 (the fourth column of vme/etc/zonelist) can use it. What counts is the zone of the program's first template, the one that was dilcopy'd or run as a command. Elsewhere the zone log gets "attempt to violate system access security (reboot)" and the program stops.
Parameters
| Name | Type | Meaning |
|---|---|---|
| code | integer | vme's exit status. 0 means all is well; the DIL integration tests (test.zon) exit with the number of a failed test, so the test script sees the failure. |
Notes
- The argument is required:
reboot;is a syntax error. - The program goes on after
reboot()until it waits or quits, and the rest of the current game loop pass runs too. End withquit. - It warns nobody. The
rebootcommand (cmd_rebootandrebootingin commands.zon) counts down and tells the players first.
Example
dilbegin failsafe();
code
{
heartbeat := PULSE_SEC * 60 * 5;
wait(SFB_TICK, TRUE);
log("Fail safe triggered");
reboot(99);
quit;
}
dilend
Stops the server with exit status 99 after five minutes, as the integration tests in test.zon do when a test hangs.