Exemple #1
0
void check_pfiles( time_t reset )
{
   /*
    * This only counts them up on reboot if the cleanup isn't needed - Samson 1-2-00 
    */
   if( reset == 255 && new_pfile_time_t > current_time )
   {
      reset = 0;  /* Call me paranoid, but it might be meaningful later on */
      log_string( "Counting pfiles....." );
      pfile_scan( TRUE );
      return;
   }

   if( new_pfile_time_t <= current_time )
   {
      if( sysdata.CLEANPFILES == TRUE )
      {

         char buf[MSL];

         /*
          * Makes a backup copy of existing pfiles just in case - Samson 
          */
         sprintf( buf, "tar -cf %spfiles.tar %s*", PLAYER_DIR, PLAYER_DIR );

         /*
          * Would use the shell pipe for this, but alas, it requires a ch in order
          * to work, this also gets called during boot_db before the rare item
          * checks for the rent code - Samson 
          */
         system( buf );

         new_pfile_time_t = current_time + 86400;
         save_timedata(  );
         log_string( "Automated pfile cleanup beginning...." );
         pfile_scan( FALSE );
#ifdef SAMSONRENT
         if( reset == 0 )
            rent_update(  );
#endif
      }
      else
      {
         new_pfile_time_t = current_time + 86400;
         save_timedata(  );
         log_string( "Counting pfiles....." );
         pfile_scan( TRUE );
#ifdef SAMSONRENT
         if( reset == 0 )
            rent_update(  );
#endif
      }
   }
   return;
}
Exemple #2
0
void do_pfiles( CHAR_DATA * ch, char *argument )
{
   char buf[512];

   if( IS_NPC( ch ) )
   {
      send_to_char( "Mobs cannot use this command!\r\n", ch );
      return;
   }

   if( argument[0] == '\0' || !argument )
   {
      /*
       * Makes a backup copy of existing pfiles just in case - Samson 
       */
      snprintf( buf, 512, "tar -czf %spfiles.tar %s*", PLAYER_DIR, PLAYER_DIR );

      /*
       * GAH, the shell pipe won't process the command that gets pieced
       * together in the preceeding lines! God only knows why. - Samson 
       */
      system( buf );

      snprintf( buf, 512, "Manual pfile cleanup started by %s.", ch->name );
      log_string( buf );
      pfile_scan( FALSE );
#ifdef SAMSONRENT
      rent_update(  );
#endif
      return;
   }

   if( !str_cmp( argument, "settime" ) )
   {
      new_pfile_time_t = current_time + 86400;
      save_timedata(  );
      send_to_char( "New cleanup time set for 24 hrs from now.\r\n", ch );
      return;
   }

   if( !str_cmp( argument, "count" ) )
   {
      snprintf( buf, 512, "Pfile count started by %s.", ch->name );
      log_string( buf );
      pfile_scan( TRUE );
      return;
   }
   send_to_char( "Invalid argument.\r\n", ch );
   return;
}