Added backupconfig command in server console.
This commit is contained in:
parent
365e7af6fd
commit
997326b44f
40
db.js
40
db.js
|
@ -706,6 +706,46 @@ module.exports.CreateDB = function (parent, func) {
|
|||
func(obj); // Completed function setup
|
||||
}
|
||||
|
||||
// Return a human readable string with current backup configuration
|
||||
obj.getBackupConfig = function () {
|
||||
var r = '', backupPath = parent.backuppath;
|
||||
if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
|
||||
const dbname = (parent.args.mongodbname) ? (parent.args.mongodbname) : 'meshcentral';
|
||||
const currentDate = new Date();
|
||||
const fileSuffix = currentDate.getFullYear() + '-' + padNumber(currentDate.getMonth() + 1, 2) + '-' + padNumber(currentDate.getDate(), 2) + '-' + padNumber(currentDate.getHours(), 2) + '-' + padNumber(currentDate.getMinutes(), 2);
|
||||
const newAutoBackupFile = 'meshcentral-autobackup-' + fileSuffix;
|
||||
const newAutoBackupPath = parent.path.join(backupPath, newAutoBackupFile);
|
||||
|
||||
r += 'DB Name: ' + dbname + '\r\n';
|
||||
r += 'DB Type: ' + ['None','NeDB','MongoJS','MongoDB'][obj.databaseType] + '\r\n';
|
||||
r += 'BackupPath: ' + backupPath + '\r\n';
|
||||
r += 'newAutoBackupFile: ' + newAutoBackupFile + '\r\n';
|
||||
r += 'newAutoBackupPath: ' + newAutoBackupPath + '\r\n';
|
||||
|
||||
if (parent.config.settings.autobackup == null) {
|
||||
r += 'No Settings/AutoBackup\r\n';
|
||||
} else {
|
||||
if (parent.config.settings.autobackup.backupintervalhours != null) {
|
||||
if (typeof parent.config.settings.autobackup.backupintervalhours != 'number') { r += 'Bad backupintervalhours type\r\n'; }
|
||||
else { r += 'Backup Interval (Hours): ' + parent.config.settings.autobackup.backupintervalhours + '\r\n'; }
|
||||
}
|
||||
if (parent.config.settings.autobackup.keeplastdaysbackup != null) {
|
||||
if (typeof parent.config.settings.autobackup.keeplastdaysbackup != 'number') { r += 'Bad keeplastdaysbackup type\r\n'; }
|
||||
else { r += 'Keep Last Backups (Days): ' + parent.config.settings.autobackup.keeplastdaysbackup + '\r\n'; }
|
||||
}
|
||||
if (parent.config.settings.autobackup.zippassword != null) {
|
||||
if (typeof parent.config.settings.autobackup.zippassword != 'string') { r += 'Bad zippassword type\r\n'; }
|
||||
else { r += 'ZIP Password Set\r\n'; }
|
||||
}
|
||||
if (parent.config.settings.autobackup.mongodumppath != null) {
|
||||
if (typeof parent.config.settings.autobackup.mongodumppath != 'string') { r += 'Bad mongodumppath type\r\n'; }
|
||||
else { r += 'MongoDump Path: ' + parent.config.settings.autobackup.mongodumppath + '\r\n'; }
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
obj.performingBackup = false;
|
||||
obj.performBackup = function () {
|
||||
try {
|
||||
|
|
|
@ -546,7 +546,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
case 'help': {
|
||||
r = 'Available commands: help, info, versions, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores,\r\n'
|
||||
r += 'migrationagents, agentstats, webstats, mpsstats, swarmstats, acceleratorsstats, updatecheck, serverupdate, nodeconfig,\r\n';
|
||||
r += 'heapdump, relays, autobackup, dupagents.';
|
||||
r += 'heapdump, relays, autobackup, backupconfig, dupagents.';
|
||||
break;
|
||||
}
|
||||
case 'dupagents': {
|
||||
|
@ -737,6 +737,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
if (backupResult == 0) { r = 'Starting auto-backup...'; } else { r = 'Backup alreay in progress.'; }
|
||||
break;
|
||||
}
|
||||
case 'backupconfig': {
|
||||
r = parent.db.getBackupConfig();
|
||||
break;
|
||||
}
|
||||
default: { // This is an unknown command, return an error message
|
||||
r = 'Unknown command \"' + cmd + '\", type \"help\" for list of avaialble commands.';
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.3.6-g",
|
||||
"version": "0.3.6-h",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
|
|
@ -81,6 +81,9 @@
|
|||
"_MaxAgentSessions": 100,
|
||||
"MaxSingleUserSessions": 10
|
||||
},
|
||||
"_Redirects": {
|
||||
"meshcommander": "https://www.meshcommander.com/"
|
||||
},
|
||||
"_yubikey": { "id": "0000", "secret": "xxxxxxxxxxxxxxxxxxxxx", "_proxy": "http://myproxy.domain.com:80" },
|
||||
"_httpheaders": { "Strict-Transport-Security": "max-age=360000" },
|
||||
"_agentConfig": [ "webSocketMaskOverride=1" ]
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
border: 1px solid #ccc;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" style="display:none;overflow:hidden">
|
||||
|
@ -69,7 +70,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
|
||||
<h1>Agent Installation<span id="groupname"></span></h1>
|
||||
<h1>Remote Agent Installation<span id="groupname"></span></h1>
|
||||
<p>
|
||||
You have been invited to install a software that will allow a remote operator to fully access your computer remotely including the desktop and files.
|
||||
Only follow the instructions below if this invitation was expected and you know who will be accessing your computer.
|
||||
|
@ -87,7 +88,7 @@
|
|||
<h3>Microsoft™ Windows 64bit</h3>
|
||||
<p><a id="win64url">Download the software here</a>, run it and press "Install" or "Connect".</p>
|
||||
<div style="text-align:center">
|
||||
<img src="images/winagent.png" />
|
||||
<img class="winagent-img" src="images/winagent.png" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -95,7 +96,7 @@
|
|||
<h3>Microsoft™ Windows 32bit</h3>
|
||||
<p><a id="win32url">Download the software here</a>, run it and press "Install" or "Connect".</p>
|
||||
<div style="text-align:center">
|
||||
<img src="images/winagent.png" />
|
||||
<img class="winagent-img" src="images/winagent.png" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -142,7 +143,7 @@
|
|||
var serverNoProxy = "{{{servernoproxy}}}";
|
||||
var installFlags = "{{{installflags}}}";
|
||||
var groupName = decodeURIComponent("{{{meshname}}}");
|
||||
if (groupName != '') { QH('groupname', ' - ' + groupName); }
|
||||
if (groupName != '') { QH('groupname', ' for ' + groupName); }
|
||||
userInterfaceSelectMenu();
|
||||
setup();
|
||||
|
||||
|
|
Loading…
Reference in New Issue