Пример #1
0
/** Admin command to check all objects.
 * \verbatim
 * This implements @wcheck/all.
 * \endverbatim
 * \param player the enactor.
 */
void
do_wcheck_all(dbref player)
{
    if (!Site(player)) {
        notify(player, T("You'd better check your site power first."));
        return;
    }
    notify(player, T("Running database topology warning checks"));
    run_topology();
    notify(player, T("Warning checks complete."));
}
Пример #2
0
/** Handle events that may need handling.
 * This routine is polled from bsd.c. At any call, it can handle
 * the HUP and USR1 signals. At calls that are 'on the second',
 * it goes on to perform regular every-second processing and to
 * check whether it's time to do other periodic processes like
 * purge, dump, or inactivity checks.
 */
void
dispatch(void)
{
  static int idle_counter = 0;
  struct module_entry_t *m;
  void (*handle)(void);

  /* A HUP reloads configuration and reopens logs */
  if (hup_triggered) {
    do_rawlog(LT_ERR, T("SIGHUP received: reloading .txt and .cnf files"));
    config_file_startup(NULL, 0);
    config_file_startup(NULL, 1);
    fcache_load(NOTHING);
    help_reindex(NOTHING);
    read_access_file();
    reopen_logs();
    hup_triggered = 0;
  }
  /* A USR1 does a shutdown/reboot */
  if (usr1_triggered) {
    do_reboot(NOTHING, 0);      /* We don't return from this */
    usr1_triggered = 0;         /* But just in case */
  }
  if (!globals.on_second)
    return;
  globals.on_second = 0;

  mudtime = time(NULL);

  do_second();

  migrate_stuff(CHUNK_MIGRATE_AMOUNT);

  if (options.purge_counter <= mudtime) {
    /* Free list reconstruction */
    options.purge_counter = options.purge_interval + mudtime;
    global_eval_context.cplr = NOTHING;
    strcpy(global_eval_context.ccom, "purge");
    purge();
    strcpy(global_eval_context.ccom, "");
  }

  if (options.dbck_counter <= mudtime) {
    /* Database consistency check */
    options.dbck_counter = options.dbck_interval + mudtime;
    global_eval_context.cplr = NOTHING;
    strcpy(global_eval_context.ccom, "dbck");
    dbck();
    strcpy(global_eval_context.ccom, "");
  }

  if (idle_counter <= mudtime) {
    /* Inactivity check */
    idle_counter = 30 + mudtime;
    inactivity_check();
  }

  /* Database dump routines */
  if (options.dump_counter <= mudtime) {
    log_mem_check();
    options.dump_counter = options.dump_interval + mudtime;
    global_eval_context.cplr = NOTHING;
    strcpy(global_eval_context.ccom, "dump");
    fork_and_dump(1);
    strcpy(global_eval_context.ccom, "");
    flag_broadcast(0, "ON-VACATION", "%s",
                   T
                   ("Your ON-VACATION flag is set! If you're back, clear it."));
  } else if (NO_FORK &&
             (options.dump_counter - 60 == mudtime) &&
             *options.dump_warning_1min) {
    flag_broadcast(0, 0, "%s", options.dump_warning_1min);
  } else if (NO_FORK &&
             (options.dump_counter - 300 == mudtime) &&
             *options.dump_warning_5min) {
    flag_broadcast(0, 0, "%s", options.dump_warning_5min);
  }
  if (options.warn_interval && (options.warn_counter <= mudtime)) {
    options.warn_counter = options.warn_interval + mudtime;
    global_eval_context.cplr = NOTHING;
    strcpy(global_eval_context.ccom, "warnings");
    run_topology();
    strcpy(global_eval_context.ccom, "");
  }
#ifdef MUSHCRON
  if((mudtime % 60) == 0)
    run_cron(); /* Run the MUSH Cron Daemon */
#endif /* MUSHCRON */
#ifdef _SWMP_
  sql_timer();
#endif
#ifdef RPMODE_SYS 
  rplog_reset();
#endif

  /* Replacement for local_timer */
  MODULE_ITER(m)
    MODULE_FUNC_NOARGS(handle, m->handle, "module_timer");
}