Check for out of disk space

Fixes #567
This commit is contained in:
girish@cloudron.io
2016-01-22 17:37:41 -08:00
parent 10f74349ca
commit de7a6abc50
6 changed files with 79 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ exports = module.exports = {
appDied: appDied,
outOfDiskSpace: outOfDiskSpace,
FEEDBACK_TYPE_FEEDBACK: 'feedback',
FEEDBACK_TYPE_TICKET: 'ticket',
FEEDBACK_TYPE_APP: 'app',
@@ -358,6 +360,19 @@ function appUpdateAvailable(app, updateInfo) {
});
}
function outOfDiskSpace(message) {
assert.strictEqual(typeof message, 'string');
var mailOptions = {
from: config.get('adminEmail'),
to: 'admin@cloudron.io',
subject: util.format('[%s] Out of disk space alert', config.fqdn()),
text: render('out_of_disk_space.ejs', { fqdn: config.fqdn(), message: message, format: 'text' })
};
sendMails([ mailOptions ]);
}
// this function bypasses the queue intentionally. it is also expected to work without the mailer module initialized
// crashnotifier should be able to send mail when there is no db
function sendCrashNotification(program, context) {