888d32f886e868837cf8ade41fa571776ab3d80e
[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 _0x41ae=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','lodash','inspect','name','index','getAllData','then','status','json','catch','killProcess','components/import/cm','format','pid','split','length','indexOf','params','kill'];(function(_0x71ae3c,_0x404627){var _0x194072=function(_0x13c008){while(--_0x13c008){_0x71ae3c['push'](_0x71ae3c['shift']());}};_0x194072(++_0x404627);}(_0x41ae,0x1ab));var _0xe41a=function(_0x5c1300,_0x3bcd37){_0x5c1300=_0x5c1300-0x0;var _0x325d53=_0x41ae[_0x5c1300];return _0x325d53;};'use strict';var info=require(_0xe41a('0x0'));var exec=require(_0xe41a('0x1'))[_0xe41a('0x2')];var logger=require('../../config/logger')(_0xe41a('0x3'));var util=require(_0xe41a('0x4'));var BPromise=require('bluebird');var _=require(_0xe41a('0x5'));function handleError(_0x5b67f7,_0x235343,_0x20dc71){_0x235343=_0x235343||0x1f4;return function(_0x9da3b3){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x20dc71,_0x235343,util[_0xe41a('0x6')](_0x9da3b3,{'showHidden':![],'depth':null}));delete _0x9da3b3[_0xe41a('0x7')];_0x5b67f7['status'](_0x235343)['send'](_0x9da3b3);};}exports[_0xe41a('0x8')]=function(_0x175b67,_0x1d2be0){return info[_0xe41a('0x9')]()[_0xe41a('0xa')](function(_0x353786){return _0x1d2be0[_0xe41a('0xb')](0xc8)[_0xe41a('0xc')](_0x353786);})[_0xe41a('0xd')](function(_0x340a33){return _0x1d2be0[_0xe41a('0xb')](0x1f4)['json'](_0x340a33);});};exports[_0xe41a('0xe')]=function(_0x48cd4a,_0x1fc15a){var _0x4f42a0=[_0xe41a('0xf')];return new BPromise(function(_0x3f0da2,_0x48285e){return exec(util[_0xe41a('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x48cd4a['params'][_0xe41a('0x11')]),function(_0x3b6f8c,_0x3beb42,_0x96d885){if(_0x3b6f8c){return _0x48285e(_0x3b6f8c);}return _0x3f0da2(_0x3beb42);});})[_0xe41a('0xa')](function(_0x283e3c){var _0x12152e=![];var _0x4f0016=_0x283e3c[_0xe41a('0x12')](/\n/);for(var _0x4eedc0=0x0,_0x48be0c=_0x4f42a0[_0xe41a('0x13')];_0x4eedc0<_0x48be0c,_0x12152e===![];_0x4eedc0+=0x1){if(_0x283e3c[_0xe41a('0x14')](_0x4f42a0[_0x4eedc0])>=0x0){_0x12152e=!![];}}if(!_0x12152e){throw new Error(util[_0xe41a('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x48cd4a[_0xe41a('0x15')]['pid']));}process[_0xe41a('0x16')](_0x48cd4a[_0xe41a('0x15')][_0xe41a('0x11')],_0xe41a('0x17'));return _0x1fc15a['status'](0xc8)['json']({'message':util['format'](_0xe41a('0x18'),_0x48cd4a['params'][_0xe41a('0x11')])});})[_0xe41a('0xd')](handleError(_0x1fc15a,null,'killProcess'));};