7e0936913f1b929fff9da06a6aef1fe77d600845
[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 _0x3cd8=['send','index','getAllData','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','api','util','bluebird','lodash','inspect','name','status'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3cd8,0x1d2));var _0x83cd=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x3cd8[_0x2b0a86];return _0x955940;};'use strict';var info=require(_0x83cd('0x0'));var exec=require(_0x83cd('0x1'))[_0x83cd('0x2')];var logger=require('../../config/logger')(_0x83cd('0x3'));var util=require(_0x83cd('0x4'));var BPromise=require(_0x83cd('0x5'));var _=require(_0x83cd('0x6'));function handleError(_0x1321bd,_0x79e4ec,_0x5251ea){_0x79e4ec=_0x79e4ec||0x1f4;return function(_0x1d4cd8){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5251ea,_0x79e4ec,util[_0x83cd('0x7')](_0x1d4cd8,{'showHidden':![],'depth':null}));delete _0x1d4cd8[_0x83cd('0x8')];_0x1321bd[_0x83cd('0x9')](_0x79e4ec)[_0x83cd('0xa')](_0x1d4cd8);};}exports[_0x83cd('0xb')]=function(_0x3ace42,_0x421092){return info[_0x83cd('0xc')]()['then'](function(_0x36b71a){return _0x421092['status'](0xc8)[_0x83cd('0xd')](_0x36b71a);})[_0x83cd('0xe')](function(_0x4f567f){return _0x421092[_0x83cd('0x9')](0x1f4)['json'](_0x4f567f);});};exports['killProcess']=function(_0x38ea1c,_0x270b00){var _0x62607a=[_0x83cd('0xf')];return new BPromise(function(_0x49a837,_0x4432ad){return exec(util['format'](_0x83cd('0x10'),_0x38ea1c[_0x83cd('0x11')][_0x83cd('0x12')]),function(_0x485f45,_0x3392a6,_0x166124){if(_0x485f45){return _0x4432ad(_0x485f45);}return _0x49a837(_0x3392a6);});})[_0x83cd('0x13')](function(_0x382cb3){var _0xe1fa50=![];var _0x4eba6f=_0x382cb3[_0x83cd('0x14')](/\n/);for(var _0x2a330d=0x0,_0x107f2=_0x62607a[_0x83cd('0x15')];_0x2a330d<_0x107f2,_0xe1fa50===![];_0x2a330d+=0x1){if(_0x382cb3['indexOf'](_0x62607a[_0x2a330d])>=0x0){_0xe1fa50=!![];}}if(!_0xe1fa50){throw new Error(util['format'](_0x83cd('0x16'),_0x38ea1c[_0x83cd('0x11')][_0x83cd('0x12')]));}process[_0x83cd('0x17')](_0x38ea1c['params'][_0x83cd('0x12')],_0x83cd('0x18'));return _0x270b00[_0x83cd('0x9')](0xc8)['json']({'message':util[_0x83cd('0x19')](_0x83cd('0x1a'),_0x38ea1c[_0x83cd('0x11')][_0x83cd('0x12')])});})[_0x83cd('0xe')](handleError(_0x270b00,null,_0x83cd('0x1b')));};