f8b3e15fec00fc036964f718319129b0dd9947d5
[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 _0xcf20=['length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','lodash','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x5525a2,_0xda29c0){var _0x4496dd=function(_0x14c8df){while(--_0x14c8df){_0x5525a2['push'](_0x5525a2['shift']());}};_0x4496dd(++_0xda29c0);}(_0xcf20,0x118));var _0x0cf2=function(_0x24f67c,_0xa144b0){_0x24f67c=_0x24f67c-0x0;var _0x25c2fc=_0xcf20[_0x24f67c];return _0x25c2fc;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x0cf2('0x0')];var logger=require(_0x0cf2('0x1'))(_0x0cf2('0x2'));var util=require(_0x0cf2('0x3'));var BPromise=require('bluebird');var _=require(_0x0cf2('0x4'));function handleError(_0x374b47,_0x35a414,_0x5c3f9e){_0x35a414=_0x35a414||0x1f4;return function(_0x3ed649){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5c3f9e,_0x35a414,util['inspect'](_0x3ed649,{'showHidden':![],'depth':null}));delete _0x3ed649['name'];_0x374b47[_0x0cf2('0x5')](_0x35a414)[_0x0cf2('0x6')](_0x3ed649);};}exports[_0x0cf2('0x7')]=function(_0x3d6c78,_0x23fd9c){return info[_0x0cf2('0x8')]()[_0x0cf2('0x9')](function(_0x1092b4){return _0x23fd9c['status'](0xc8)[_0x0cf2('0xa')](_0x1092b4);})[_0x0cf2('0xb')](function(_0x37f379){return _0x23fd9c[_0x0cf2('0x5')](0x1f4)[_0x0cf2('0xa')](_0x37f379);});};exports[_0x0cf2('0xc')]=function(_0x58850f,_0x2f601a){var _0x19d0f6=[_0x0cf2('0xd')];return new BPromise(function(_0x3bf77b,_0x38d3c6){return exec(util[_0x0cf2('0xe')](_0x0cf2('0xf'),_0x58850f[_0x0cf2('0x10')][_0x0cf2('0x11')]),function(_0x2a1299,_0x208a6a,_0x2b0824){if(_0x2a1299){return _0x38d3c6(_0x2a1299);}return _0x3bf77b(_0x208a6a);});})[_0x0cf2('0x9')](function(_0x5a77b3){var _0x3333e3=![];var _0x5fdf74=_0x5a77b3[_0x0cf2('0x12')](/\n/);for(var _0x230d05=0x0,_0x3cdefc=_0x19d0f6[_0x0cf2('0x13')];_0x230d05<_0x3cdefc,_0x3333e3===![];_0x230d05+=0x1){if(_0x5a77b3['indexOf'](_0x19d0f6[_0x230d05])>=0x0){_0x3333e3=!![];}}if(!_0x3333e3){throw new Error(util[_0x0cf2('0xe')](_0x0cf2('0x14'),_0x58850f[_0x0cf2('0x10')]['pid']));}process[_0x0cf2('0x15')](_0x58850f['params']['pid'],'SIGINT');return _0x2f601a[_0x0cf2('0x5')](0xc8)['json']({'message':util[_0x0cf2('0xe')](_0x0cf2('0x16'),_0x58850f['params']['pid'])});})['catch'](handleError(_0x2f601a,null,_0x0cf2('0xc')));};