mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
1. Added -E switch to sudo, to preserve proxy settings
2. Added uninstallAgent console command
This commit is contained in:
parent
60af11542f
commit
57ab51ed6f
2 changed files with 14 additions and 2 deletions
|
@ -1863,6 +1863,18 @@ function createMeshCore(agent)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'uninstallagent':
|
||||
var agentName = process.platform == 'win32' ? 'Mesh Agent' : 'meshagent';
|
||||
if (!require('service-manager').manager.getService(agentName).isMe())
|
||||
{
|
||||
response = 'Uininstall failed, this instance is not the service instance';
|
||||
}
|
||||
else
|
||||
{
|
||||
var js = "require('service-manager').manager.getService('" + agentName + "').stop(); require('service-manager').manager.uninstallService('" + agentName + "'); process.exit();";
|
||||
this.child = require('child_process').execFile(process.execPath, [process.platform == 'win32' ? (process.execPath.split('\\').pop()) : (process.execPath.split('/').pop()), '-b64exec', Buffer.from(js).toString('base64')], { type: 4, detached: true });
|
||||
}
|
||||
break;
|
||||
case 'notify': { // Send a notification message to the mesh
|
||||
if (args['_'].length != 1) {
|
||||
response = 'Proper usage: notify "message" [--session]'; // Display correct command usage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue