2bb8ed097d0e39f4a5f0b63751c364c00460be83
[motion2.git] / server / api / system / system.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x9857=['child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9857,0x86));var _0x7985=function(_0x39ce86,_0x443990){_0x39ce86=_0x39ce86-0x0;var _0x18d410=_0x9857[_0x39ce86];return _0x18d410;};'use strict';var info=require(_0x7985('0x0'));var exec=require(_0x7985('0x1'))[_0x7985('0x2')];var logger=require(_0x7985('0x3'))(_0x7985('0x4'));var util=require(_0x7985('0x5'));var BPromise=require('bluebird');var _=require(_0x7985('0x6'));function handleError(_0x4822e3,_0xb7a991,_0x1b820a){_0xb7a991=_0xb7a991||0x1f4;return function(_0x24f397){logger[_0x7985('0x7')](_0x7985('0x8'),_0x1b820a,_0xb7a991,util[_0x7985('0x9')](_0x24f397,{'showHidden':![],'depth':null}));delete _0x24f397['name'];_0x4822e3[_0x7985('0xa')](_0xb7a991)[_0x7985('0xb')](_0x24f397);};}exports['index']=function(_0x28e4e5,_0x572648){return info[_0x7985('0xc')]()[_0x7985('0xd')](function(_0x1526dc){return _0x572648['status'](0xc8)[_0x7985('0xe')](_0x1526dc);})['catch'](function(_0x351968){return _0x572648[_0x7985('0xa')](0x1f4)['json'](_0x351968);});};exports[_0x7985('0xf')]=function(_0x4ca0a0,_0x71ec81){var _0x32ee26=[_0x7985('0x10')];return new BPromise(function(_0x2acf0d,_0x11039e){return exec(util[_0x7985('0x11')](_0x7985('0x12'),_0x4ca0a0[_0x7985('0x13')][_0x7985('0x14')]),function(_0x46f743,_0x3e1460,_0x347b09){if(_0x46f743){return _0x11039e(_0x46f743);}return _0x2acf0d(_0x3e1460);});})[_0x7985('0xd')](function(_0x203c4c){var _0x56aff9=![];var _0x472672=_0x203c4c['split'](/\n/);for(var _0x44d587=0x0,_0x3fd7a3=_0x32ee26[_0x7985('0x15')];_0x44d587<_0x3fd7a3,_0x56aff9===![];_0x44d587+=0x1){if(_0x203c4c[_0x7985('0x16')](_0x32ee26[_0x44d587])>=0x0){_0x56aff9=!![];}}if(!_0x56aff9){throw new Error(util[_0x7985('0x11')](_0x7985('0x17'),_0x4ca0a0[_0x7985('0x13')][_0x7985('0x14')]));}process[_0x7985('0x18')](_0x4ca0a0['params'][_0x7985('0x14')],_0x7985('0x19'));return _0x71ec81['status'](0xc8)[_0x7985('0xe')]({'message':util[_0x7985('0x11')](_0x7985('0x1a'),_0x4ca0a0[_0x7985('0x13')]['pid'])});})['catch'](handleError(_0x71ec81,null,_0x7985('0xf')));};