lib/server/server.js
function (server, app) {
  let env = app.get(Constants.RESERVED.ENV);
  let p = path.join(app.getBase(), app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON);
  if (!fs.existsSync(p)) {
    p = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CRON));
    if (!fs.existsSync(p)) {
      return;
    }
  }
  app.loadConfigBaseApp(Constants.RESERVED.CRONS, app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON);
  let crons = app.get(Constants.RESERVED.CRONS);
  for (let serverType in crons) {
    if (app.serverType === serverType) {
      let list = crons[serverType];
      for (let i = 0; i < list.length; i++) {
        if (!list[i].serverId) {
          checkAndAdd(list[i], server.crons, server);
        } else {
          if (app.serverId === list[i].serverId) {
            checkAndAdd(list[i], server.crons, server);
          }
        }
      }
    }
  }
}
function (server, app) {
  let env = app.get(Constants.RESERVED.ENV);
  let p = path.join(app.getBase(), app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON);
  if (!fs.existsSync(p)) {
    p = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CRON));
    if (!fs.existsSync(p)) {
      return;
    }
  }
  app.loadConfigBaseApp(Constants.RESERVED.CRONS, app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON);
  let crons = app.get(Constants.RESERVED.CRONS);
  for (let serverType in crons) {
    if (app.serverType === serverType) {
      let list = crons[serverType];
      for (let i = 0; i < list.length; i++) {
        if (!list[i].serverId) {
          checkAndAdd(list[i], server.crons, server);
        } else {
          if (app.serverId === list[i].serverId) {
            checkAndAdd(list[i], server.crons, server);
          }
        }
      }
    }
  }
}
function ( server , app ) { let env = app . get ( Constants . RESERVED . ENV ) ; let p = path . join ( app . getBase ( ) , app . get ( Constants . RESERVED . SERVICE_PATH ) , Constants . FILEPATH . CRON ) ; if ( ! fs . existsSync ( p ) ) { p = path . join ( app . getBase ( ) , Constants . FILEPATH . CONFIG_DIR , env , path . basename ( Constants . FILEPATH . CRON ) ) ; if ( ! fs . existsSync ( p ) ) { return ; } } app . loadConfigBaseApp ( Constants . RESERVED . CRONS , app . get ( Constants . RESERVED . SERVICE_PATH ) , Constants . FILEPATH . CRON ) ; let crons = app . get ( Constants . RESERVED . CRONS ) ; for ( let serverType in crons ) { if ( app . serverType === serverType ) { let list = crons [ serverType ] ; for ( let i = 0 ; i < list . length ; i ++ ) { if ( ! list [ i ] . serverId ) { checkAndAdd ( list [ i ] , server . crons , server ) ; } else { if ( app . serverId === list [ i ] . serverId ) { checkAndAdd ( list [ i ] , server . crons , server ) ; } } } } } }
Load crons from configure file
Load crons from configure file