Built motion from commit (unavailable).|2.4.4
[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 _0x73fb=['indexOf','pid','kill','SIGINT','catch','killProcess','systeminformation','exec','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','then','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length'];(function(_0x1a88a5,_0x4270fb){var _0x163c4e=function(_0x56a9d7){while(--_0x56a9d7){_0x1a88a5['push'](_0x1a88a5['shift']());}};_0x163c4e(++_0x4270fb);}(_0x73fb,0xa7));var _0xb73f=function(_0x4321f0,_0x4d79f5){_0x4321f0=_0x4321f0-0x0;var _0x142f1f=_0x73fb[_0x4321f0];return _0x142f1f;};'use strict';var info=require(_0xb73f('0x0'));var exec=require('child_process')[_0xb73f('0x1')];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require(_0xb73f('0x2'));var _=require(_0xb73f('0x3'));function handleError(_0x54df51,_0x337a5d,_0x52a627){_0x337a5d=_0x337a5d||0x1f4;return function(_0x57b379){logger[_0xb73f('0x4')](_0xb73f('0x5'),_0x52a627,_0x337a5d,util[_0xb73f('0x6')](_0x57b379,{'showHidden':![],'depth':null}));delete _0x57b379['name'];_0x54df51[_0xb73f('0x7')](_0x337a5d)[_0xb73f('0x8')](_0x57b379);};}exports[_0xb73f('0x9')]=function(_0x3c2854,_0x2c0649){return info['getAllData']()[_0xb73f('0xa')](function(_0x297350){return _0x2c0649['status'](0xc8)['json'](_0x297350);})['catch'](function(_0x2ebdba){return _0x2c0649['status'](0x1f4)[_0xb73f('0xb')](_0x2ebdba);});};exports['killProcess']=function(_0x48675f,_0x34d063){var _0x59ebfa=['components/import/cm'];return new BPromise(function(_0x20f7f8,_0x25c17d){return exec(util[_0xb73f('0xc')](_0xb73f('0xd'),_0x48675f[_0xb73f('0xe')]['pid']),function(_0x13981a,_0x39ead8,_0xb1e3ca){if(_0x13981a){return _0x25c17d(_0x13981a);}return _0x20f7f8(_0x39ead8);});})[_0xb73f('0xa')](function(_0x491f8d){var _0x24601b=![];var _0x51ec64=_0x491f8d[_0xb73f('0xf')](/\n/);for(var _0x3f18b4=0x0,_0x35e35f=_0x59ebfa[_0xb73f('0x10')];_0x3f18b4<_0x35e35f,_0x24601b===![];_0x3f18b4+=0x1){if(_0x491f8d[_0xb73f('0x11')](_0x59ebfa[_0x3f18b4])>=0x0){_0x24601b=!![];}}if(!_0x24601b){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x48675f['params'][_0xb73f('0x12')]));}process[_0xb73f('0x13')](_0x48675f[_0xb73f('0xe')][_0xb73f('0x12')],_0xb73f('0x14'));return _0x34d063['status'](0xc8)[_0xb73f('0xb')]({'message':util[_0xb73f('0xc')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x48675f[_0xb73f('0xe')]['pid'])});})[_0xb73f('0x15')](handleError(_0x34d063,null,_0xb73f('0x16')));};