Make autobackup: false disable all backup functions and remove cmdline from checkbackup error message. (#7225)

This commit is contained in:
PTR
2025-08-11 15:29:34 +02:00
committed by GitHub
parent 6bb1441330
commit 87c37ea3f9
2 changed files with 7 additions and 7 deletions

8
db.js
View File

@@ -3348,7 +3348,7 @@ module.exports.CreateDB = function (parent, func) {
// Tries configured custom location with fallback to default location
// Now runs after autobackup config init in meshcentral.js so config options are checked
obj.checkBackupCapability = function (func) {
if ((parent.config.settings.autobackup == null) || (parent.config.settings.autobackup == false)) { return; };
if (parent.config.settings.autobackup.backupintervalhours == -1) { return; };
//block backup until validated. Gets put back if all checks are ok.
let backupInterval = parent.config.settings.autobackup.backupintervalhours;
parent.config.settings.autobackup.backupintervalhours = -1;
@@ -3395,7 +3395,7 @@ module.exports.CreateDB = function (parent, func) {
const child_process = require('child_process');
child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
if ((error != null) && (error != '')) {
func(1, "Mongodump error, backup will not be performed. Command tried: " + cmd + ' --> ERROR: ' + stderr);
func(1, "Mongodump error, backup will not be performed. Check path or use mongodumppath & mongodumpargs");
return;
} else {parent.config.settings.autobackup.backupintervalhours = backupInterval;}
});
@@ -3406,7 +3406,7 @@ module.exports.CreateDB = function (parent, func) {
const child_process = require('child_process');
child_process.exec(cmd, { cwd: backupPath, timeout: 1000*30 }, function(error, stdout, stdin) {
if ((error != null) && (error != '')) {
func(1, "mysqldump error, backup will not be performed. Command tried: " + cmd);
func(1, "mysqldump error, backup will not be performed. Check path or use mysqldumppath");
return;
} else {parent.config.settings.autobackup.backupintervalhours = backupInterval;}
@@ -3421,7 +3421,7 @@ module.exports.CreateDB = function (parent, func) {
const child_process = require('child_process');
child_process.exec(cmd, { cwd: backupPath }, function(error, stdout, stdin) {
if ((error != null) && (error != '')) {
func(1, "pg_dump error, backup will not be performed. Command tried: " + cmd);
func(1, "pg_dump error, backup will not be performed. Check path or use pgdumppath.");
return;
} else {parent.config.settings.autobackup.backupintervalhours = backupInterval;}
});