reboot countdown

Posted by Celest on Thu 05 Oct 2006 09:54 PM — 11 posts, 44,918 views.

#0
I was just wondering, what would be the easiest way to tweak the reboot code to include a global countdown. Ie. 5 Minutes to system reboot, 4 min etc. etc
USA #1
Simply replace the existing echoes that display on a reboot.
#2
True, but how would i setup the timing for it, is there any specific function i can use instead of it echoing everything all it once. ie. 5 min to reboot, (a minute passes) 4min to reboot etc.
Thanks for the reply though :)
USA #3
Isn't that already set up?
When it prepares for a reboot it echos various messages about the world losing stabilty and so forth at very specific numbers of minutes before the actual reboot. All you should have to do is change those messages.
USA #4
in update.c there is a function called reboot_check, post the code to it and also post the code where it is called from, not the whole function, just the specific section surrounding it, if it is spitting all the echoes at once something is wrong with the code.
Australia Forum Administrator #5
As he said, in update.c look for these lines:


void reboot_check( time_t reset )
{
   static char *tmsg[] = { "You feel the ground shake as the end comes near!",
      "Lightning crackles in the sky above!",
      "Crashes of thunder sound across the land!",
      "The sky has suddenly turned midnight black.",
      "You notice the life forms around you slowly dwindling away.",
      "The seas across the realm have turned frigid.",
      "The aura of magic that surrounds the realms seems slightly unstable.",
      "You sense a change in the magical forces surrounding you."
   };
   static const int times[] = { 60, 120, 180, 240, 300, 600, 900, 1800 };


Just change the messages like "You sense a change in the magical forces surrounding you." to "Reboot in 3 minutes", and so on.
USA #6
That's what I'd suggested on mudbytes in response to this too, but I was told there that what he's asking about has to do with the reboot command rather than the auto-reboot and that the manual reboot doesn't call reboot_check and that he's also having issues with it outputting all of those messages at once. So I'm at a loss. The best suggestion I've seen so far for him was that AFK no longer has auto-reboot but instead has something like what he's after and to take a look at it.
Australia Forum Administrator #7
Check out the setboot command:

http://www.gammon.com.au/forum/?wiki=setboot

Can't you just set a reboot in 15 minutes, and let the messages come out? I tried that and it seemed to work ok:


setboot time 15 50
Log: Nick: setboot time 15 50
Boot time set to Sat Oct  7 15:50:00 2006

(a minute later)

Lightning crackles in the sky above!

(a minute later)

You feel the ground shake as the end comes near!

(a minute later)

You are forced from these realms by a strong magical presence
as life here is reconstructed.
Log: Automatic Reboot

Log: Normal termination of game.
Log: Cleaning up Memory.

USA #8
*shrug* Works that way for me too. I routinely use setboot to set when my auto-reboot will take place.
USA #9
With the way I changed it in AFKMud it doesn't need the setboot command. In fact, that command doesn't even exist anymore in our code. Typing "reboot" with no arguments leads to an immediate 5 minute countdown. This countdown can be aborted by typing reboot again before it's finished.

The automatic reboot was a hack by the Smaug team to cover up a whole lot of serious memory leak problems they had with the code. Since 99% of those have been caught now between FUSS and AFKMud, the automatic boot isn't really necessary anymore. The mud will run for days, weeks, probably months if I'd let it, without significant memory loss.
USA #10
I should probably rip out the auto reboot stuff on mine and replace it with what AFK has too. Usually I use setboot to set the boot time to 6am on the 1st of the upcoming month more as a reminder to the staff and players that we'll be rebooting the server then. I only actually hotboot my mud every so often to bring online new stuff (varies from weekly to several times per day, depending on how busy my staff & I have been) and reboot my server itself (rather than the mud) on the first of each month. I can't recall the last time my mud actually did a reboot. *shrug*