3c92e9e015abb359a2af3459cdacab476d268388
[motion.git] / server / config / scheduler / index.js
1 var _0x7a31=["\x53\x63\x68\x65\x64\x75\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x63\x72\x6F\x6E\x2D\x6A\x6F\x62\x2D\x6D\x61\x6E\x61\x67\x65\x72","\x6C\x6F\x64\x61\x73\x68","\x2E\x2F\x72\x65\x70\x6F\x72\x74\x73","\x6D\x6F\x74\x69\x6F\x6E","\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x44\x65\x6C\x65\x74\x69\x6E\x67\x20","\x6E\x61\x6D\x65","\x20\x6A\x6F\x62","\x64\x65\x62\x75\x67","\x69\x64","\x65\x78\x69\x73\x74\x73","\x64\x65\x6C\x65\x74\x65\x4A\x6F\x62","\x49\x20\x67\x6F\x74\x20\x74\x68\x65\x20\x63\x75\x72\x72\x65\x6E\x74\x20\x6A\x6F\x62\x73\x3A\x20","\x4A\x6F\x62\x20","\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x55\x70\x64\x61\x74\x69\x6E\x67\x20","\x61\x63\x74\x69\x76\x65","\x65\x78\x70\x6F\x72\x74\x73","\x45\x72\x72\x6F\x72\x20\x67\x65\x74\x74\x69\x6E\x67\x2F\x73\x65\x74\x74\x69\x6E\x67\x20\x73\x63\x68\x65\x64\x75\x6C\x65\x73","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x66\x69\x6E\x61\x6C\x6C\x79","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x74\x79\x70\x65","\x63\x72\x6F\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x27","\x27\x20\x6A\x6F\x62","\x30\x30\x20","\x20\x73\x74\x6F\x70\x70\x65\x64","\x61\x64\x64","\x4A\x6F\x62\x20\x27","\x27\x20\x63\x72\x65\x61\x74\x65\x64\x21","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x73\x63\x68\x65\x64\x75\x6C\x65\x20","\x69\x6E\x66\x6F","\x45\x72\x72\x6F\x72\x20\x72\x65\x74\x72\x69\x65\x76\x69\x6E\x67\x20\x73\x63\x68\x65\x64\x75\x6C\x65\x21","\x73\x74\x61\x63\x6B","\x53\x63\x68\x65\x64\x75\x6C\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\x65\x78\x74\x72\x61\x63\x74\x52\x65\x70\x6F\x72\x74","\x72\x65\x70\x6F\x72\x74","\x66\x69\x6E\x64\x42\x79\x49\x64","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79"];var Schedule=require(_0x7a31[1])[_0x7a31[0]];var MailServerOut=require(_0x7a31[1])[_0x7a31[2]];var CronJobManager=require(_0x7a31[3]);var _=require(_0x7a31[4]);var Reports=require(_0x7a31[5]);var logger=require(_0x7a31[7])(_0x7a31[6]);function deleteSchedule(_0x1ad8x8,_0x1ad8x9){logger[_0x7a31[11]](_0x7a31[8]+ _0x1ad8x8[_0x7a31[9]]+ _0x7a31[10]);if(_0x1ad8x9[_0x7a31[13]](_0x1ad8x8[_0x7a31[12]].toString())){_0x1ad8x9[_0x7a31[14]](_0x1ad8x8[_0x7a31[12]].toString());logger[_0x7a31[11]](_0x7a31[15]+ _0x1ad8x9)}else {logger[_0x7a31[11]](_0x7a31[16]+ _0x1ad8x8[_0x7a31[9]]+ _0x7a31[17])}}function updateSchedule(_0x1ad8x8,_0x1ad8x9,_0x1ad8xb){logger[_0x7a31[11]](_0x7a31[18]+ _0x1ad8x8[_0x7a31[9]]+ _0x7a31[10]);if(_0x1ad8x8[_0x7a31[19]]){createJob(_0x1ad8x8,_0x1ad8x9,_0x1ad8xb)}else {deleteSchedule(_0x1ad8x8,_0x1ad8x9)}}module[_0x7a31[20]]= function(){var _0x1ad8x9= new CronJobManager();var _0x1ad8xb= new Reports();Schedule[_0x7a31[29]]({where:{active:true},attributes:[_0x7a31[12],_0x7a31[9],_0x7a31[27],_0x7a31[19],_0x7a31[28]]})[_0x7a31[26]](function(_0x1ad8xd){_[_0x7a31[25]](_0x1ad8xd,function(_0x1ad8xe){createJob(_0x1ad8xe,_0x1ad8x9,_0x1ad8xb)})})[_0x7a31[24]](function(){synchSchedules(_0x1ad8x9,_0x1ad8xb)})[_0x7a31[23]](function(_0x1ad8xc){logger[_0x7a31[22]](_0x7a31[21])})};function createJob(_0x1ad8xe,_0x1ad8x9,_0x1ad8xb){logger[_0x7a31[11]](_0x7a31[30]+ _0x1ad8xe[_0x7a31[9]]+ _0x7a31[31]);_0x1ad8x9[_0x7a31[34]](_0x1ad8xe[_0x7a31[12]].toString(),_0x7a31[32]+ _0x1ad8xe[_0x7a31[28]],function(){executeSchedule(_0x1ad8xe[_0x7a31[12]],_0x1ad8xb)},{start:true,completion:function(){logger[_0x7a31[11]](_0x7a31[16]+ _0x1ad8xe[_0x7a31[9]]+ _0x7a31[33])}});logger[_0x7a31[11]](_0x7a31[35]+ _0x1ad8xe[_0x7a31[9]]+ _0x7a31[36]);logger[_0x7a31[11]](_0x7a31[15]+ _0x1ad8x9)}function executeSchedule(_0x1ad8x11,_0x1ad8xb){logger[_0x7a31[38]](_0x7a31[37],_0x1ad8x11);return Schedule[_0x7a31[44]](_0x1ad8x11,{include:[MailServerOut]})[_0x7a31[26]](function(_0x1ad8xe){if(!_0x1ad8xe){logger[_0x7a31[22]](_0x7a31[41]);return};switch(_0x1ad8xe[_0x7a31[27]]){case _0x7a31[43]:_0x1ad8xb[_0x7a31[42]](_0x1ad8xe);break;default:}})[_0x7a31[23]](function(_0x1ad8xc){logger[_0x7a31[22]](_0x7a31[39],_0x1ad8xc[_0x7a31[40]])})}function synchSchedules(_0x1ad8x9,_0x1ad8xb){Schedule[_0x7a31[46]](function(_0x1ad8x13,_0x1ad8x14){if(_0x1ad8x13[_0x7a31[19]]){createJob(_0x1ad8x13[_0x7a31[45]],_0x1ad8x9,_0x1ad8xb)}});Schedule[_0x7a31[47]](function(_0x1ad8x13,_0x1ad8x14){updateSchedule(_0x1ad8x13[_0x7a31[45]],_0x1ad8x9,_0x1ad8xb)});Schedule[_0x7a31[48]](function(_0x1ad8x13){deleteSchedule(_0x1ad8x13[_0x7a31[45]],_0x1ad8x9)})}