var zxy = require('zxy-comm');

//初始化定时器
var jobObj = function (setting) {
    var schedule = require('node-schedule');
    var rule = new schedule.RecurrenceRule();
    for (var key in setting.conf) {
        rule[key] = setting.conf[key];
    }
    schedule.scheduleJob(rule, function () {
        if(setting.script && typeof setting.script == "function"){
            setting.script();
        }
        if(setting.script && typeof setting.script == "string"){
            console.log(setting.script);
            require(setting.script)();
        }
    });
}
exports.jobObj = jobObj;