diff --git a/src/backups.js b/src/backups.js index 39442e8fa..942868b8b 100644 --- a/src/backups.js +++ b/src/backups.js @@ -1024,12 +1024,13 @@ function startBackupTask(auditSource, callback) { eventlog.add(eventlog.ACTION_BACKUP_START, auditSource, { taskId }); - tasks.startTask(taskId, { timeout: 12 * 60 * 60 * 1000 /* 12 hours */ }, function (error, result) { + tasks.startTask(taskId, { timeout: 12 * 60 * 60 * 1000 /* 12 hours */ }, function (error, backupId) { locker.unlock(locker.OP_FULL_BACKUP); const errorMessage = error ? error.message : ''; + const timedOut = error ? error.code === tasks.ETIMEOUT : false; - eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId: taskId, errorMessage: errorMessage, backupId: result }); + eventlog.add(eventlog.ACTION_BACKUP_FINISH, auditSource, { taskId, errorMessage, timedOut, backupId }); }); callback(null, taskId); diff --git a/src/custom.js b/src/custom.js index 885f84b03..4ae69d497 100644 --- a/src/custom.js +++ b/src/custom.js @@ -38,7 +38,7 @@ const DEFAULT_SPEC = { }, alerts: { email: '', - notifyCloudronAdmins: false + notifyCloudronAdmins: true }, footer: { body: '© 2019 [Cloudron](https://cloudron.io) [Forum ](https://forum.cloudron.io)' diff --git a/src/notifications.js b/src/notifications.js index 894fd7f27..e5b7a5c5e 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -294,7 +294,7 @@ function backupFailed(eventId, taskId, errorMessage, callback) { actionForAllAdmins([], function (admin, callback) { mailer.backupFailed(admin.email, errorMessage, `${settings.adminOrigin()}/logs.html?taskId=${taskId}`); - add(admin.id, eventId, 'Failed to backup', `Backup failed: ${errorMessage}. Logs are available [here](/logs.html?taskId=${taskId}). Will be retried in 4 hours`, callback); + add(admin.id, eventId, 'Backup failed', `Backup failed: ${errorMessage}. Logs are available [here](/logs.html?taskId=${taskId}). Will be retried in 4 hours`, callback); }, callback); } @@ -379,8 +379,10 @@ function onEvent(id, action, source, data, callback) { return certificateRenewalError(id, data.domain, data.errorMessage, callback); case eventlog.ACTION_BACKUP_FINISH: - if (!data.errorMessage || source.username !== 'cron') return callback(); - return backupFailed(id, data.taskId, data.errorMessage, callback); // only notify for automated backups + if (!data.errorMessage) return callback(); + if (source.username !== auditSource.CRON.username && !data.timedOut) return callback(); // manual stop by user + + return backupFailed(id, data.taskId, data.errorMessage, callback); // only notify for automated backups or timedout case eventlog.ACTION_UPDATE_FINISH: return boxUpdated(data.oldVersion, data.newVersion, callback);