Difference between revisions of "Manual:DIL Manual/reboot"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bpreboot"></span>
+
= reboot =
 +
'''Procedure.''' Shuts the game server down.
  
−
  '''Function: '''<i><!--CODE-->reboot ;</i><!--ENDCODE-->
+
  reboot(code : integer)
−
This function works like a quit command.  Anything after the reboot function in a Dil will not be
 
−
executed the mud will reboot instantly.  The zone must have root privileges in
 
−
the zonelist in order to use this function.
 
−
'''Simple reboot command'''
 
−
<i><!--CODE-->
 
−
---~---~---~---~---~---~---~---~---
 
  
−
dilbegin cmd_reboot (arg:string);
+
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.
−
code
 
−
dilend
 
  
−
---~---~---~---~---~---~---~---~---
+
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.
  
−
</i><!--ENDCODE-->
+
== Parameters ==
−
<span id="bpreboot"></span>
+
{| 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.
 +
|}
  
−
'''Function: '''<i><!--CODE-->reboot ;</i><!--ENDCODE-->
+
== Notes ==
−
This function works like a quit command. Anything after the reboot function in a Dil will not be
+
* The argument is required: <code>reboot;</code> is a syntax error.
−
executed the mud will reboot instantly. The zone must have root privileges in
+
* 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>.
−
the zonelist in order to use this function.
+
* 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.
−
'''Simple reboot command'''
 
−
<i><!--CODE-->
 
−
---~---~---~---~---~---~---~---~---
 
  
−
dilbegin cmd_reboot (arg:string);
+
== Example ==
−
code
+
<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]]
−
</i><!--ENDCODE-->
+
* [[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 with quit.
  • It warns nobody. The reboot command (cmd_reboot and rebooting in 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.

See also