f8f1fe70b6bbb055a6c47b8d6789f6e4283dc443
[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 _0x6741=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','json','catch','killProcess'];(function(_0x38f8e9,_0x36eede){var _0x269e6a=function(_0x120dda){while(--_0x120dda){_0x38f8e9['push'](_0x38f8e9['shift']());}};_0x269e6a(++_0x36eede);}(_0x6741,0x136));var _0x1674=function(_0x4d0456,_0x382073){_0x4d0456=_0x4d0456-0x0;var _0x2c7b54=_0x6741[_0x4d0456];return _0x2c7b54;};'use strict';var info=require('systeminformation');var exec=require(_0x1674('0x0'))[_0x1674('0x1')];var logger=require(_0x1674('0x2'))(_0x1674('0x3'));var util=require(_0x1674('0x4'));var BPromise=require('bluebird');var _=require(_0x1674('0x5'));function handleError(_0x3f5470,_0x3bce75,_0x6a9f57){_0x3bce75=_0x3bce75||0x1f4;return function(_0xd3f837){logger['error'](_0x1674('0x6'),_0x6a9f57,_0x3bce75,util['inspect'](_0xd3f837,{'showHidden':![],'depth':null}));delete _0xd3f837[_0x1674('0x7')];_0x3f5470[_0x1674('0x8')](_0x3bce75)[_0x1674('0x9')](_0xd3f837);};}exports[_0x1674('0xa')]=function(_0x1d8aed,_0x3884d2){return info[_0x1674('0xb')]()['then'](function(_0x414976){return _0x3884d2[_0x1674('0x8')](0xc8)[_0x1674('0xc')](_0x414976);})[_0x1674('0xd')](function(_0x1b2edc){return _0x3884d2[_0x1674('0x8')](0x1f4)[_0x1674('0xc')](_0x1b2edc);});};exports[_0x1674('0xe')]=function(_0x46926b,_0x4d3b40){var _0x3f5e61=[_0x1674('0xf')];return new BPromise(function(_0x3896fc,_0x57de88){return exec(util[_0x1674('0x10')](_0x1674('0x11'),_0x46926b[_0x1674('0x12')][_0x1674('0x13')]),function(_0x1d7169,_0x2f2fe4,_0x23892f){if(_0x1d7169){return _0x57de88(_0x1d7169);}return _0x3896fc(_0x2f2fe4);});})['then'](function(_0x11e22e){var _0x1c7b51=![];var _0x5d3fb1=_0x11e22e[_0x1674('0x14')](/\n/);for(var _0x353247=0x0,_0x2557b3=_0x3f5e61[_0x1674('0x15')];_0x353247<_0x2557b3,_0x1c7b51===![];_0x353247+=0x1){if(_0x11e22e[_0x1674('0x16')](_0x3f5e61[_0x353247])>=0x0){_0x1c7b51=!![];}}if(!_0x1c7b51){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x46926b[_0x1674('0x12')][_0x1674('0x13')]));}process[_0x1674('0x17')](_0x46926b[_0x1674('0x12')][_0x1674('0x13')],'SIGINT');return _0x4d3b40[_0x1674('0x8')](0xc8)[_0x1674('0xc')]({'message':util[_0x1674('0x10')](_0x1674('0x18'),_0x46926b['params'][_0x1674('0x13')])});})[_0x1674('0xd')](handleError(_0x4d3b40,null,'killProcess'));};