72d468a06d209dce4897a3c4b70e9024284d96ce
[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 _0xe11f=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','catch'];(function(_0x35e731,_0x245366){var _0x175069=function(_0x3d1c84){while(--_0x3d1c84){_0x35e731['push'](_0x35e731['shift']());}};_0x175069(++_0x245366);}(_0xe11f,0x98));var _0xfe11=function(_0x48347d,_0x31ee2a){_0x48347d=_0x48347d-0x0;var _0x110f3d=_0xe11f[_0x48347d];return _0x110f3d;};'use strict';var info=require(_0xfe11('0x0'));var exec=require(_0xfe11('0x1'))[_0xfe11('0x2')];var logger=require(_0xfe11('0x3'))('api');var util=require(_0xfe11('0x4'));var BPromise=require('bluebird');var _=require(_0xfe11('0x5'));function handleError(_0x2d7b3b,_0x2ecce8,_0x374f27){_0x2ecce8=_0x2ecce8||0x1f4;return function(_0x23e32f){logger[_0xfe11('0x6')](_0xfe11('0x7'),_0x374f27,_0x2ecce8,util[_0xfe11('0x8')](_0x23e32f,{'showHidden':![],'depth':null}));delete _0x23e32f['name'];_0x2d7b3b[_0xfe11('0x9')](_0x2ecce8)[_0xfe11('0xa')](_0x23e32f);};}exports[_0xfe11('0xb')]=function(_0x309bdd,_0x478582){return info[_0xfe11('0xc')]()[_0xfe11('0xd')](function(_0x4c1775){return _0x478582[_0xfe11('0x9')](0xc8)[_0xfe11('0xe')](_0x4c1775);})[_0xfe11('0xf')](function(_0x5c8150){return _0x478582['status'](0x1f4)[_0xfe11('0xe')](_0x5c8150);});};exports['killProcess']=function(_0x3b871b,_0x518e78){var _0x594242=[_0xfe11('0x10')];return new BPromise(function(_0xede761,_0x1e8293){return exec(util[_0xfe11('0x11')](_0xfe11('0x12'),_0x3b871b[_0xfe11('0x13')][_0xfe11('0x14')]),function(_0x51148d,_0x2ed568,_0xb45624){if(_0x51148d){return _0x1e8293(_0x51148d);}return _0xede761(_0x2ed568);});})[_0xfe11('0xd')](function(_0x337679){var _0x46c02c=![];var _0x63b28a=_0x337679[_0xfe11('0x15')](/\n/);for(var _0x3f4b81=0x0,_0x425b9b=_0x594242[_0xfe11('0x16')];_0x3f4b81<_0x425b9b,_0x46c02c===![];_0x3f4b81+=0x1){if(_0x337679[_0xfe11('0x17')](_0x594242[_0x3f4b81])>=0x0){_0x46c02c=!![];}}if(!_0x46c02c){throw new Error(util[_0xfe11('0x11')](_0xfe11('0x18'),_0x3b871b['params'][_0xfe11('0x14')]));}process['kill'](_0x3b871b[_0xfe11('0x13')][_0xfe11('0x14')],_0xfe11('0x19'));return _0x518e78[_0xfe11('0x9')](0xc8)['json']({'message':util[_0xfe11('0x11')](_0xfe11('0x1a'),_0x3b871b[_0xfe11('0x13')][_0xfe11('0x14')])});})[_0xfe11('0xf')](handleError(_0x518e78,null,_0xfe11('0x1b')));};