Re: [NEWBIE] shutdown/reboot of mud

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 07/31/01


Dwight Durmon wrote:
>
> I have two questions, both of which relate to each other...
>
> 1.  Is there a way to gracefully shut down CircleMud without having an
> Immortal or other god log in?

The easiest way is to use a cron job to shut the MUD down.  The harder
way is to tweak the MUD so it shuts itself down at a ceartain time of
day.  I did something similar for running daily maintenance of my MUD.
The hard part of the latter is that you have to actually code in two
different places for the shutdown, the reason being that the MUD might
or might not be asleep when the time rolls around.  If there's players
in the MUD then you can shut it down by having a heartbeat function
check the time of day and shut it down as appropriate.  If the MUD is
asleep, then you need to tweak the call to select() so that it has a
timeout equal to the amount of time left until the shutdown time, then
check for this when select() returns and shutdown the MUD as appropriate
(see the select man page for more info).

> 2. Is there source code out some where that allows the restriction of login
> times?  Or maybe print a message based on the time of day?

I don't know of any snippet or patch to do this, though it shouldn't be
very hard to do.  Just add a variable to the char_data structure to
store the logout time, then add a set value to the current time when a
player logs in and use a heartbeat function to run through all the
players and force-logout those who are expired.  You can vary this in
different ways depending on exactly how you want to implement it.

Regards, Peter

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST