Built motion from commit 74d9782e.|2.6.30
[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 _0x8289=['split','length','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','api','util','lodash','error','inspect','name','status','send','index','getAllData','then','catch','json','format','pid'];(function(_0x1613d9,_0x2f583e){var _0x1ab5e0=function(_0xbfca35){while(--_0xbfca35){_0x1613d9['push'](_0x1613d9['shift']());}};_0x1ab5e0(++_0x2f583e);}(_0x8289,0x1bb));var _0x9828=function(_0x3b1d66,_0x59476f){_0x3b1d66=_0x3b1d66-0x0;var _0x68ed2d=_0x8289[_0x3b1d66];return _0x68ed2d;};'use strict';var info=require(_0x9828('0x0'));var exec=require('child_process')[_0x9828('0x1')];var logger=require('../../config/logger')(_0x9828('0x2'));var util=require(_0x9828('0x3'));var BPromise=require('bluebird');var _=require(_0x9828('0x4'));function handleError(_0xd2292a,_0x487827,_0x15e5bf){_0x487827=_0x487827||0x1f4;return function(_0x1838a5){logger[_0x9828('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x15e5bf,_0x487827,util[_0x9828('0x6')](_0x1838a5,{'showHidden':![],'depth':null}));delete _0x1838a5[_0x9828('0x7')];_0xd2292a[_0x9828('0x8')](_0x487827)[_0x9828('0x9')](_0x1838a5);};}exports[_0x9828('0xa')]=function(_0x431a0d,_0x2cf5a4){return info[_0x9828('0xb')]()[_0x9828('0xc')](function(_0x22461e){return _0x2cf5a4[_0x9828('0x8')](0xc8)['json'](_0x22461e);})[_0x9828('0xd')](function(_0x47ef5c){return _0x2cf5a4[_0x9828('0x8')](0x1f4)[_0x9828('0xe')](_0x47ef5c);});};exports['killProcess']=function(_0x35b491,_0x5cadb9){var _0x5a2343=['components/import/cm'];return new BPromise(function(_0x49811c,_0x1f0436){return exec(util[_0x9828('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x35b491['params'][_0x9828('0x10')]),function(_0x39e704,_0x10c2d6,_0x4ee70d){if(_0x39e704){return _0x1f0436(_0x39e704);}return _0x49811c(_0x10c2d6);});})[_0x9828('0xc')](function(_0x32621d){var _0x44275d=![];var _0x1c7903=_0x32621d[_0x9828('0x11')](/\n/);for(var _0x14fc0d=0x0,_0x19e522=_0x5a2343[_0x9828('0x12')];_0x14fc0d<_0x19e522,_0x44275d===![];_0x14fc0d+=0x1){if(_0x32621d['indexOf'](_0x5a2343[_0x14fc0d])>=0x0){_0x44275d=!![];}}if(!_0x44275d){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x35b491[_0x9828('0x13')][_0x9828('0x10')]));}process[_0x9828('0x14')](_0x35b491[_0x9828('0x13')][_0x9828('0x10')],'SIGINT');return _0x5cadb9['status'](0xc8)[_0x9828('0xe')]({'message':util[_0x9828('0xf')](_0x9828('0x15'),_0x35b491['params'][_0x9828('0x10')])});})[_0x9828('0xd')](handleError(_0x5cadb9,null,_0x9828('0x16')));};