Added backupconfig command in server console.
Ylian Saint-Hilaire committed
Jun 7, 2019 at 16:44 UTC
85ed10abd841307ee8e8beee728497fb431c525c
5 files changed
+54
-6
db.js
+40
@@ -706,6 +706,46 @@ module.exports.CreateDB = function (parent, func) {
706
func(obj); // Completed function setup
707
}
708
709
+ // Return a human readable string with current backup configuration
710
+ obj.getBackupConfig = function () {
711
+ var r = '', backupPath = parent.backuppath;
712
+ if (parent.config.settings.autobackup && parent.config.settings.autobackup.backuppath) { backupPath = parent.config.settings.autobackup.backuppath; }
713
+ const dbname = (parent.args.mongodbname) ? (parent.args.mongodbname) : 'meshcentral';
714
+ const currentDate = new Date();
715
+ const fileSuffix = currentDate.getFullYear() + '-' + padNumber(currentDate.getMonth() + 1, 2) + '-' + padNumber(currentDate.getDate(), 2) + '-' + padNumber(currentDate.getHours(), 2) + '-' + padNumber(currentDate.getMinutes(), 2);
716
+ const newAutoBackupFile = 'meshcentral-autobackup-' + fileSuffix;
717
+ const newAutoBackupPath = parent.path.join(backupPath, newAutoBackupFile);
718
+
719
+ r += 'DB Name: ' + dbname + '\r\n';
720
+ r += 'DB Type: ' + ['None','NeDB','MongoJS','MongoDB'][obj.databaseType] + '\r\n';
721
+ r += 'BackupPath: ' + backupPath + '\r\n';
722
+ r += 'newAutoBackupFile: ' + newAutoBackupFile + '\r\n';
723
+ r += 'newAutoBackupPath: ' + newAutoBackupPath + '\r\n';
724
+
725
+ if (parent.config.settings.autobackup == null) {
726
+ r += 'No Settings/AutoBackup\r\n';
727
+ } else {
728
+ if (parent.config.settings.autobackup.backupintervalhours != null) {
729
+ if (typeof parent.config.settings.autobackup.backupintervalhours != 'number') { r += 'Bad backupintervalhours type\r\n'; }
730
+ else { r += 'Backup Interval (Hours): ' + parent.config.settings.autobackup.backupintervalhours + '\r\n'; }
731
+ }
732
+ if (parent.config.settings.autobackup.keeplastdaysbackup != null) {
733
+ if (typeof parent.config.settings.autobackup.keeplastdaysbackup != 'number') { r += 'Bad keeplastdaysbackup type\r\n'; }
734
+ else { r += 'Keep Last Backups (Days): ' + parent.config.settings.autobackup.keeplastdaysbackup + '\r\n'; }
735
+ }
736
+ if (parent.config.settings.autobackup.zippassword != null) {
737
+ if (typeof parent.config.settings.autobackup.zippassword != 'string') { r += 'Bad zippassword type\r\n'; }
738
+ else { r += 'ZIP Password Set\r\n'; }
739
+ }
740
+ if (parent.config.settings.autobackup.mongodumppath != null) {
741
+ if (typeof parent.config.settings.autobackup.mongodumppath != 'string') { r += 'Bad mongodumppath type\r\n'; }
742
+ else { r += 'MongoDump Path: ' + parent.config.settings.autobackup.mongodumppath + '\r\n'; }
743
+ }
744
+ }
745
+
746
+ return r;
747
+ }
748
+
749
obj.performingBackup = false;
750
obj.performBackup = function () {
751
try {
meshuser.js
+5
-1
@@ -546,7 +546,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
546
case 'help': {
547
r = 'Available commands: help, info, versions, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores,\r\n'
548
r += 'migrationagents, agentstats, webstats, mpsstats, swarmstats, acceleratorsstats, updatecheck, serverupdate, nodeconfig,\r\n';
549
- r += 'heapdump, relays, autobackup, dupagents.';
549
+ r += 'heapdump, relays, autobackup, backupconfig, dupagents.';
550
break;
551
}
552
case 'dupagents': {
@@ -737,6 +737,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
737
if (backupResult == 0) { r = 'Starting auto-backup...'; } else { r = 'Backup alreay in progress.'; }
738
break;
739
}
740
+ case 'backupconfig': {
741
+ r = parent.db.getBackupConfig();
742
+ break;
743
+ }
744
default: { // This is an unknown command, return an error message
745
r = 'Unknown command \"' + cmd + '\", type \"help\" for list of avaialble commands.';
746
break;
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.3.6-g",
3
+ "version": "0.3.6-h",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
sample-config.json
+3
@@ -81,6 +81,9 @@
81
"_MaxAgentSessions": 100,
82
"MaxSingleUserSessions": 10
83
},
84
+ "_Redirects": {
85
+ "meshcommander": "https://www.meshcommander.com/"
86
+ },
87
"_yubikey": { "id": "0000", "secret": "xxxxxxxxxxxxxxxxxxxxx", "_proxy": "http://myproxy.domain.com:80" },
88
"_httpheaders": { "Strict-Transport-Security": "max-age=360000" },
89
"_agentConfig": [ "webSocketMaskOverride=1" ]
views/agentinvite.handlebars
+5
-4
@@ -40,6 +40,7 @@
40
border: 1px solid #ccc;
41
border-top: none;
42
}
43
+
44
</style>
45
</head>
46
<body id="body" onload="if (typeof(startup) !== 'undefined') startup();" style="display:none;overflow:hidden">
@@ -69,7 +70,7 @@
70
</div>
71
</div>
72
<div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
72
- <h1>Agent Installation<span id="groupname"></span></h1>
73
+ <h1>Remote Agent Installation<span id="groupname"></span></h1>
74
<p>
75
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.
76
Only follow the instructions below if this invitation was expected and you know who will be accessing your computer.
@@ -87,7 +88,7 @@
88
<h3>Microsoft™ Windows 64bit</h3>
89
<p><a id="win64url">Download the software here</a>, run it and press "Install" or "Connect".</p>
90
<div style="text-align:center">
90
- <img src="images/winagent.png" />
91
+ <img class="winagent-img" src="images/winagent.png" />
92
</div>
93
</div>
94
@@ -95,7 +96,7 @@
96
<h3>Microsoft™ Windows 32bit</h3>
97
<p><a id="win32url">Download the software here</a>, run it and press "Install" or "Connect".</p>
98
<div style="text-align:center">
98
- <img src="images/winagent.png" />
99
+ <img class="winagent-img" src="images/winagent.png" />
100
</div>
101
</div>
102
@@ -142,7 +143,7 @@
143
var serverNoProxy = "{{{servernoproxy}}}";
144
var installFlags = "{{{installflags}}}";
145
var groupName = decodeURIComponent("{{{meshname}}}");
145
- if (groupName != '') { QH('groupname', ' - ' + groupName); }
146
+ if (groupName != '') { QH('groupname', ' for ' + groupName); }
147
userInterfaceSelectMenu();
148
setup();
149