cf285fc437d384a0ae95001b86717b4c620d2d05
[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 _0xbc2b=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','status','json','components/import/cm','format','params','pid','split','length'];(function(_0x30ee6e,_0x3551e6){var _0x201fc6=function(_0x3141dd){while(--_0x3141dd){_0x30ee6e['push'](_0x30ee6e['shift']());}};_0x201fc6(++_0x3551e6);}(_0xbc2b,0x11e));var _0xbbc2=function(_0xbffd6c,_0x4bd0f6){_0xbffd6c=_0xbffd6c-0x0;var _0x37eb6c=_0xbc2b[_0xbffd6c];return _0x37eb6c;};'use strict';var info=require(_0xbbc2('0x0'));var exec=require('child_process')[_0xbbc2('0x1')];var logger=require(_0xbbc2('0x2'))(_0xbbc2('0x3'));var util=require(_0xbbc2('0x4'));var BPromise=require(_0xbbc2('0x5'));var _=require(_0xbbc2('0x6'));function handleError(_0x10ad7d,_0xf18d2e,_0x50ca0f){_0xf18d2e=_0xf18d2e||0x1f4;return function(_0x56a959){logger[_0xbbc2('0x7')](_0xbbc2('0x8'),_0x50ca0f,_0xf18d2e,util['inspect'](_0x56a959,{'showHidden':![],'depth':null}));delete _0x56a959[_0xbbc2('0x9')];_0x10ad7d['status'](_0xf18d2e)[_0xbbc2('0xa')](_0x56a959);};}exports[_0xbbc2('0xb')]=function(_0x334127,_0x387ea4){return info[_0xbbc2('0xc')]()[_0xbbc2('0xd')](function(_0x4e8ba4){return _0x387ea4[_0xbbc2('0xe')](0xc8)[_0xbbc2('0xf')](_0x4e8ba4);})['catch'](function(_0x40489d){return _0x387ea4[_0xbbc2('0xe')](0x1f4)[_0xbbc2('0xf')](_0x40489d);});};exports['killProcess']=function(_0x4d12e7,_0x14259c){var _0x36f3e3=[_0xbbc2('0x10')];return new BPromise(function(_0x5f3a2e,_0x43dfe6){return exec(util[_0xbbc2('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4d12e7[_0xbbc2('0x12')][_0xbbc2('0x13')]),function(_0x3e6e28,_0x4bac42,_0x7a84dd){if(_0x3e6e28){return _0x43dfe6(_0x3e6e28);}return _0x5f3a2e(_0x4bac42);});})[_0xbbc2('0xd')](function(_0x1a7aa0){var _0x38a5f3=![];var _0xe99460=_0x1a7aa0[_0xbbc2('0x14')](/\n/);for(var _0x13e585=0x0,_0x11592f=_0x36f3e3[_0xbbc2('0x15')];_0x13e585<_0x11592f,_0x38a5f3===![];_0x13e585+=0x1){if(_0x1a7aa0[_0xbbc2('0x16')](_0x36f3e3[_0x13e585])>=0x0){_0x38a5f3=!![];}}if(!_0x38a5f3){throw new Error(util[_0xbbc2('0x11')](_0xbbc2('0x17'),_0x4d12e7[_0xbbc2('0x12')]['pid']));}process[_0xbbc2('0x18')](_0x4d12e7[_0xbbc2('0x12')]['pid'],_0xbbc2('0x19'));return _0x14259c[_0xbbc2('0xe')](0xc8)[_0xbbc2('0xf')]({'message':util[_0xbbc2('0x11')](_0xbbc2('0x1a'),_0x4d12e7['params']['pid'])});})['catch'](handleError(_0x14259c,null,_0xbbc2('0x1b')));};