8955cf09c487a89377f415069d56778b5e908298
[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 _0x9147=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','inspect','status','getAllData','catch','json','killProcess','components/import/cm'];(function(_0x15f449,_0x2f1388){var _0x517ab6=function(_0x1b6b27){while(--_0x1b6b27){_0x15f449['push'](_0x15f449['shift']());}};_0x517ab6(++_0x2f1388);}(_0x9147,0x81));var _0x7914=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9147[_0x2dafbe];return _0x58a45a;};'use strict';var info=require(_0x7914('0x0'));var exec=require(_0x7914('0x1'))[_0x7914('0x2')];var logger=require(_0x7914('0x3'))(_0x7914('0x4'));var util=require(_0x7914('0x5'));var BPromise=require(_0x7914('0x6'));var _=require('lodash');function handleError(_0x21cae6,_0x1de2bc,_0x1f8716){_0x1de2bc=_0x1de2bc||0x1f4;return function(_0x280cdb){logger[_0x7914('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1f8716,_0x1de2bc,util[_0x7914('0x8')](_0x280cdb,{'showHidden':![],'depth':null}));delete _0x280cdb['name'];_0x21cae6[_0x7914('0x9')](_0x1de2bc)['send'](_0x280cdb);};}exports['index']=function(_0xa22f08,_0x8ce32){return info[_0x7914('0xa')]()['then'](function(_0x104e12){return _0x8ce32[_0x7914('0x9')](0xc8)['json'](_0x104e12);})[_0x7914('0xb')](function(_0x48d5c9){return _0x8ce32[_0x7914('0x9')](0x1f4)[_0x7914('0xc')](_0x48d5c9);});};exports[_0x7914('0xd')]=function(_0x417299,_0x502d5e){var _0x58a902=[_0x7914('0xe')];return new BPromise(function(_0x2fc465,_0x555924){return exec(util[_0x7914('0xf')](_0x7914('0x10'),_0x417299[_0x7914('0x11')][_0x7914('0x12')]),function(_0x42a5a0,_0xefbdbb,_0x43c791){if(_0x42a5a0){return _0x555924(_0x42a5a0);}return _0x2fc465(_0xefbdbb);});})['then'](function(_0x289740){var _0x26561a=![];var _0x590e1e=_0x289740[_0x7914('0x13')](/\n/);for(var _0x228e33=0x0,_0xb62f5f=_0x58a902[_0x7914('0x14')];_0x228e33<_0xb62f5f,_0x26561a===![];_0x228e33+=0x1){if(_0x289740[_0x7914('0x15')](_0x58a902[_0x228e33])>=0x0){_0x26561a=!![];}}if(!_0x26561a){throw new Error(util[_0x7914('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x417299[_0x7914('0x11')][_0x7914('0x12')]));}process[_0x7914('0x16')](_0x417299[_0x7914('0x11')][_0x7914('0x12')],_0x7914('0x17'));return _0x502d5e['status'](0xc8)[_0x7914('0xc')]({'message':util[_0x7914('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x417299[_0x7914('0x11')][_0x7914('0x12')])});})[_0x7914('0xb')](handleError(_0x502d5e,null,_0x7914('0xd')));};