ed7f61374e187324bcde6cce6f790eb0c51e9700
[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 _0x6905=['then','status','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6905,0x18a));var _0x5690=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x6905[_0x4bfade];return _0x272465;};'use strict';var info=require(_0x5690('0x0'));var exec=require('child_process')[_0x5690('0x1')];var logger=require(_0x5690('0x2'))('api');var util=require(_0x5690('0x3'));var BPromise=require('bluebird');var _=require(_0x5690('0x4'));function handleError(_0x1e091e,_0x5348e4,_0x34abc4){_0x5348e4=_0x5348e4||0x1f4;return function(_0x3b3577){logger[_0x5690('0x5')](_0x5690('0x6'),_0x34abc4,_0x5348e4,util[_0x5690('0x7')](_0x3b3577,{'showHidden':![],'depth':null}));delete _0x3b3577[_0x5690('0x8')];_0x1e091e['status'](_0x5348e4)['send'](_0x3b3577);};}exports[_0x5690('0x9')]=function(_0x99c47d,_0x50e86c){return info[_0x5690('0xa')]()[_0x5690('0xb')](function(_0x56f740){return _0x50e86c[_0x5690('0xc')](0xc8)['json'](_0x56f740);})[_0x5690('0xd')](function(_0x3d24e9){return _0x50e86c[_0x5690('0xc')](0x1f4)['json'](_0x3d24e9);});};exports[_0x5690('0xe')]=function(_0x533861,_0x12f4d3){var _0x15d368=[_0x5690('0xf')];return new BPromise(function(_0x226b05,_0x2157e7){return exec(util[_0x5690('0x10')](_0x5690('0x11'),_0x533861['params'][_0x5690('0x12')]),function(_0x6486fd,_0x198090,_0x44b6c4){if(_0x6486fd){return _0x2157e7(_0x6486fd);}return _0x226b05(_0x198090);});})[_0x5690('0xb')](function(_0x1935aa){var _0xd81601=![];var _0x5c5f1d=_0x1935aa[_0x5690('0x13')](/\n/);for(var _0x1deee9=0x0,_0x3eb0b9=_0x15d368[_0x5690('0x14')];_0x1deee9<_0x3eb0b9,_0xd81601===![];_0x1deee9+=0x1){if(_0x1935aa[_0x5690('0x15')](_0x15d368[_0x1deee9])>=0x0){_0xd81601=!![];}}if(!_0xd81601){throw new Error(util[_0x5690('0x10')](_0x5690('0x16'),_0x533861['params'][_0x5690('0x12')]));}process[_0x5690('0x17')](_0x533861[_0x5690('0x18')][_0x5690('0x12')],_0x5690('0x19'));return _0x12f4d3[_0x5690('0xc')](0xc8)['json']({'message':util[_0x5690('0x10')](_0x5690('0x1a'),_0x533861[_0x5690('0x18')][_0x5690('0x12')])});})[_0x5690('0xd')](handleError(_0x12f4d3,null,'killProcess'));};