111335e7b9b739e61668c215a469a64f1db24c99
[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 _0x1f54=['format','params','pid','then','split','length','indexOf','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','killProcess'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x1f54,0x122));var _0x41f5=function(_0x36211c,_0x178508){_0x36211c=_0x36211c-0x0;var _0xd2487b=_0x1f54[_0x36211c];return _0xd2487b;};'use strict';var info=require(_0x41f5('0x0'));var exec=require('child_process')['exec'];var logger=require(_0x41f5('0x1'))(_0x41f5('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0xaf5c70,_0x30385f,_0x46a440){_0x30385f=_0x30385f||0x1f4;return function(_0x1915e2){logger['error'](_0x41f5('0x3'),_0x46a440,_0x30385f,util['inspect'](_0x1915e2,{'showHidden':![],'depth':null}));delete _0x1915e2[_0x41f5('0x4')];_0xaf5c70[_0x41f5('0x5')](_0x30385f)[_0x41f5('0x6')](_0x1915e2);};}exports[_0x41f5('0x7')]=function(_0xcc62ab,_0x4dcd68){return info[_0x41f5('0x8')]()['then'](function(_0x248ae9){return _0x4dcd68[_0x41f5('0x5')](0xc8)['json'](_0x248ae9);})['catch'](function(_0x77854c){return _0x4dcd68[_0x41f5('0x5')](0x1f4)['json'](_0x77854c);});};exports[_0x41f5('0x9')]=function(_0x4e48de,_0x161cda){var _0x2b752a=['components/import/cm'];return new BPromise(function(_0x4b6022,_0x5ab289){return exec(util[_0x41f5('0xa')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4e48de[_0x41f5('0xb')][_0x41f5('0xc')]),function(_0x5afa2f,_0x425c6f,_0x69ef93){if(_0x5afa2f){return _0x5ab289(_0x5afa2f);}return _0x4b6022(_0x425c6f);});})[_0x41f5('0xd')](function(_0x3e21f){var _0x5e1dbd=![];var _0x164ab9=_0x3e21f[_0x41f5('0xe')](/\n/);for(var _0x440cf5=0x0,_0x4bf18d=_0x2b752a[_0x41f5('0xf')];_0x440cf5<_0x4bf18d,_0x5e1dbd===![];_0x440cf5+=0x1){if(_0x3e21f[_0x41f5('0x10')](_0x2b752a[_0x440cf5])>=0x0){_0x5e1dbd=!![];}}if(!_0x5e1dbd){throw new Error(util[_0x41f5('0xa')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4e48de[_0x41f5('0xb')][_0x41f5('0xc')]));}process['kill'](_0x4e48de[_0x41f5('0xb')][_0x41f5('0xc')],_0x41f5('0x11'));return _0x161cda[_0x41f5('0x5')](0xc8)[_0x41f5('0x12')]({'message':util[_0x41f5('0xa')](_0x41f5('0x13'),_0x4e48de['params']['pid'])});})['catch'](handleError(_0x161cda,null,_0x41f5('0x9')));};