fe146a85efe9e5440230bdf88e670a8515ea2a06
[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 _0x8f19=['index','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send'];(function(_0x4e24cb,_0x239c1d){var _0x31e7cb=function(_0x8d2770){while(--_0x8d2770){_0x4e24cb['push'](_0x4e24cb['shift']());}};_0x31e7cb(++_0x239c1d);}(_0x8f19,0x98));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x98f1('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x98f1('0x1'))(_0x98f1('0x2'));var util=require(_0x98f1('0x3'));var BPromise=require(_0x98f1('0x4'));var _=require(_0x98f1('0x5'));function handleError(_0x1d78e9,_0x3b3892,_0x3bdd36){_0x3b3892=_0x3b3892||0x1f4;return function(_0x5481b7){logger[_0x98f1('0x6')](_0x98f1('0x7'),_0x3bdd36,_0x3b3892,util['inspect'](_0x5481b7,{'showHidden':![],'depth':null}));delete _0x5481b7[_0x98f1('0x8')];_0x1d78e9['status'](_0x3b3892)[_0x98f1('0x9')](_0x5481b7);};}exports[_0x98f1('0xa')]=function(_0x2968d3,_0x59a907){return info['getAllData']()[_0x98f1('0xb')](function(_0x39cc2c){return _0x59a907[_0x98f1('0xc')](0xc8)[_0x98f1('0xd')](_0x39cc2c);})[_0x98f1('0xe')](function(_0x1d3f7c){return _0x59a907[_0x98f1('0xc')](0x1f4)[_0x98f1('0xd')](_0x1d3f7c);});};exports[_0x98f1('0xf')]=function(_0x11136f,_0x45f3af){var _0x12ad12=[_0x98f1('0x10')];return new BPromise(function(_0x156a84,_0x28c5da){return exec(util[_0x98f1('0x11')](_0x98f1('0x12'),_0x11136f['params'][_0x98f1('0x13')]),function(_0x290056,_0x9efed0,_0x4718cb){if(_0x290056){return _0x28c5da(_0x290056);}return _0x156a84(_0x9efed0);});})[_0x98f1('0xb')](function(_0x4138c7){var _0x56d737=![];var _0x4c20f4=_0x4138c7[_0x98f1('0x14')](/\n/);for(var _0x59bdbe=0x0,_0x26147a=_0x12ad12[_0x98f1('0x15')];_0x59bdbe<_0x26147a,_0x56d737===![];_0x59bdbe+=0x1){if(_0x4138c7['indexOf'](_0x12ad12[_0x59bdbe])>=0x0){_0x56d737=!![];}}if(!_0x56d737){throw new Error(util[_0x98f1('0x11')](_0x98f1('0x16'),_0x11136f[_0x98f1('0x17')][_0x98f1('0x13')]));}process[_0x98f1('0x18')](_0x11136f[_0x98f1('0x17')][_0x98f1('0x13')],_0x98f1('0x19'));return _0x45f3af[_0x98f1('0xc')](0xc8)[_0x98f1('0xd')]({'message':util[_0x98f1('0x11')](_0x98f1('0x1a'),_0x11136f['params'][_0x98f1('0x13')])});})['catch'](handleError(_0x45f3af,null,'killProcess'));};