Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yahoo!, Bing

Members: 0
Guests: 30
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Need help with automatic rebo...
Forum Rules | Mark all | Recent Posts

Need help with automatic reboot system
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2 next >>
Post is unread #1 Jul 11, 2011, 9:30 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

So I changed my reboot system to the one in chronicles1.2a. It makes it where u can set the time and how many days apart with cset.

It all says correctly as shown on cset. But for some reason it doesn't show up on the time command, and the mud never reboots.

here is the stuff from comm.c
  gettimeofday( &now_time, NULL );
  current_time = ( time_t ) now_time.tv_sec;
/*  gettimeofday( &boot_time, NULL);   okay, so it's kludgy, sue me :) */
  boot_time = time( 0 );  /*  <-- I think this is what you wanted */
  strcpy( str_boot_time, ctime( &current_time ) );

 /*
   * Init boot time.
   */
  set_boot_time = &set_boot_time_struct;
  set_boot_time->manual = 0;

  new_boot_time = update_time( localtime( &current_time ) );
  /*
   * Copies *new_boot_time to new_boot_struct, and then points
   * new_boot_time to new_boot_struct again. -- Alty
   */
  new_boot_struct = *new_boot_time;
  new_boot_time = &new_boot_struct;
  if( new_boot_time->tm_hour > 3 )
    new_boot_time->tm_mday += sysdata.autoboot_period;
  new_boot_time->tm_sec = 0;
  new_boot_time->tm_min = sysdata.autoboot_minute;
  new_boot_time->tm_hour = sysdata.autoboot_hour;

 /*
   * Update new_boot_time (due to day increment)
   */
  new_boot_time = update_time( new_boot_time );
  new_boot_struct = *new_boot_time;
  new_boot_time = &new_boot_struct;
  /*
   * Bug fix submitted by Gabe Yoder
   */
  new_boot_time_t = mktime( new_boot_time );
  reboot_check( mktime( new_boot_time ) );
  /*
   * Set reboot time string for do_time
   */
  get_reboot_string(  );

Everything else in comm.c sets correctly, but the reboot time. Any ideas?
       
Post is unread #2 Jul 12, 2011, 3:22 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Would have to give us a bit more info on how it isn't working correct.

Looks like you posted the part that if I recall goes in the boot_db part.

Did you add for it to show in the time command?
Have a reboot_check added in somewhere in game_loop?
       
Post is unread #3 Jul 12, 2011, 8:36 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

reboot check is in the update.c and its not just the time command, the MUD won't auto reboot at all.

Here is the reboot check

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 };
   static const int timesize = UMIN(sizeof(times)/sizeof(*times), sizeof(tmsg)/sizeof(*tmsg));
   char buf[MAX_STRING_LENGTH];
   static int trun;
   static bool init = FALSE;

 if ( !init || reset >= current_time )
  {
    for ( trun = timesize-1; trun >= 0; trun-- )
      if ( reset >= current_time+times[trun] )
        break;
    init = TRUE;
    return;
  }

  if ( new_boot_time_t - boot_time < 60*60*18 &&
      !set_boot_time->manual )
    return;

 if ( new_boot_time_t <= current_time )
  {
    CHAR_DATA *vch;

      if( auction->item )
      {
         snprintf( buf, MAX_STRING_LENGTH, "Sale of %s has been stopped by mud.", auction->item->short_descr );
         talk_auction( buf );
         obj_to_char( auction->item, auction->seller );
         auction->item = NULL;
         if( auction->buyer && auction->buyer != auction->seller )
         {
            auction->buyer->gold += auction->bet;
            send_to_char( "Your money has been returned.\r\n", auction->buyer );
         }
      }
    echo_to_all( AT_YELLOW, "You are forced from the universe by a strong "
                 "presence\n\ras life here is reconstructed.", ECHOTAR_ALL );
      log_string( "Automatic Reboot" );
      for( vch = first_char; vch; vch = vch->next )
         if( !IS_NPC( vch ) )
            save_char_obj( vch );
      mud_down = TRUE;
      return;
   }

   if( trun != -1 && new_boot_time_t - current_time <= times[trun] )
   {
    echo_to_all(AT_YELLOW, tmsg[trun], ECHOTAR_ALL);
      if( trun <= 5 )
         sysdata.DENY_NEW_PLAYERS = TRUE;
      --trun;
      return;
   }
   
}
       
Post is unread #4 Jul 13, 2011, 2:51 am   Last edited Jul 13, 2011, 2:51 am by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

I mean though have you added in so the time command would show the time the mud should reboot?

Have you added in for it to call reboot_check somewhere randomly so it can auto reboot?
       
Post is unread #5 Jul 13, 2011, 6:11 am   Last edited Jul 13, 2011, 7:45 am by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

i think so, it calls reboot_string which sets the reboot_time which is called by the time command.

And the reboot_check functon is called in the whole called right above the pfile_scanner system in update.c
That part posted from comm.c is the only thing I changed, makes me wonder if it ever worked? Is it possible it's turned off ?
       
Post is unread #6 Jul 13, 2011, 7:47 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Here is what the time command displays.

It is 9 o'clock am, Day of Monday, 29th day in the Month of Shenron.
It is the season of winter, in the year 28.
The mud started up at : Tue Jul 12 04:46:58 2011
The system time : Wed Jul 13, 2011 2:51:08 PM UTC
Next Reboot is set for : Tue Jul 12 00:00:00 2011
Your local time : Wed Jul 13, 2011 10:51:08 AM Atlantic, Canada
The next pfile cleanup is in 12 hours 49 minutes 37 seconds.
It is a new moon tonight. [ O ]
       
Post is unread #7 Jul 13, 2011, 12:30 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Well its not showing a time which means its not setting it right or just not showing it right so either way need to get it working correctly, at the point in comm.c after it sets it have it log all the data as it does each part as well as the end result its been a long time but I recall it being an issue in how it sets the info.
       
Post is unread #8 Jul 13, 2011, 2:46 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

I'm not sure how to do that.
       
Post is unread #9 Jul 13, 2011, 3:14 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Ok, think I know what your problem is. Your using system data that isn't loaded till farther down in the function. I would change the location to after the boot_db is done or give temp data and as it loads the system stuff set it then. up to you on how you handle it really :).
       
Post is unread #10 Jul 13, 2011, 3:40 pm   Last edited Jul 13, 2011, 3:44 pm by dbna2
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Thanks that is what the problem was!!!!
       
Post is unread #11 Jul 18, 2011, 9:10 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

So the rebooting time is being set now, but it's still now rebooting.



The system time : Tue Jul 19, 2011 4:13:30 AM UTC
Next Reboot is set for : Tue Jul 19 04:00:00 2011
       
Post is unread #12 Jul 19, 2011, 2:30 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

I would advise putting in some log messages in the reboot_check function as well as where it is called so you can tell if it is being called or not and if so where it is going wrong and not rebooting. Be careful with them though because it can be spammy in the log file if not put in the right place.
       
Post is unread #13 Jul 20, 2011, 2:54 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Not sure where I should place these messages, any suggestions?
       
Post is unread #14 Jul 20, 2011, 3:27 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Well about thirty mins before the time it should start showing messages about rebooting. Should check the normal *the mud doing it itself* as well as if you manually set it to do a reboot in 35 mins or something to check the messages. If it shows the messages and just doesn't reboot or if it doesn't even show the messages we will figure it out from there. Good starting point though since they are already there.
       
Post is unread #15 Jul 20, 2011, 7:56 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

When set using setboot it works perfectly fine.
       
Post is unread #16 Jul 21, 2011, 2:33 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

  if ( new_boot_time_t - boot_time < 60*60*18 &&
      !set_boot_time->manual )
    return;

Well since it works fine if you manually set it, I'd focus on this part mainly since when set manually it ignores this part. It is in the reboot_check function.
       
Post is unread #17 Jul 21, 2011, 7:06 am
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

if I remove that u think it would work ?
       
Post is unread #18 Jul 24, 2011, 10:16 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Give it a try :)
       
Post is unread #19 Jul 26, 2011, 8:56 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,866
JoinedJul 26, 2005

Have you gave it a shot yet?
       
Post is unread #20 Jul 26, 2011, 4:46 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Haven't been able to try it yet, Work as been killer. but even if I take this out, I still want it to be able to use the manual setting.
       
Pages:<< prev 1, 2 next >>