You've already forked crontab-ui
mirror of
https://github.com/alseambusher/crontab-ui.git
synced 2025-12-15 11:43:58 +08:00
store mail options in db
This commit is contained in:
11
crontab.js
11
crontab.js
@@ -15,7 +15,7 @@ var os = require("os");
|
||||
exports.log_folder = __dirname + '/crontabs/logs';
|
||||
exports.env_file = __dirname + '/crontabs/env.db';
|
||||
|
||||
crontab = function(name, command, schedule, stopped, logging){
|
||||
crontab = function(name, command, schedule, stopped, logging, mailing){
|
||||
var data = {};
|
||||
data.name = name;
|
||||
data.command = command;
|
||||
@@ -25,17 +25,20 @@ crontab = function(name, command, schedule, stopped, logging){
|
||||
}
|
||||
data.timestamp = (new Date()).toString();
|
||||
data.logging = logging;
|
||||
if (!mailing)
|
||||
mailing = {};
|
||||
data.mailing = mailing;
|
||||
return data;
|
||||
};
|
||||
|
||||
exports.create_new = function(name, command, schedule, logging){
|
||||
var tab = crontab(name, command, schedule, false, logging);
|
||||
exports.create_new = function(name, command, schedule, logging, mailing){
|
||||
var tab = crontab(name, command, schedule, false, logging, mailing);
|
||||
tab.created = new Date().valueOf();
|
||||
db.insert(tab);
|
||||
};
|
||||
|
||||
exports.update = function(data){
|
||||
db.update({_id: data._id}, crontab(data.name, data.command, data.schedule, null, data.logging));
|
||||
db.update({_id: data._id}, crontab(data.name, data.command, data.schedule, null, data.logging, data.mailing));
|
||||
};
|
||||
|
||||
exports.status = function(_id, stopped){
|
||||
|
||||
Reference in New Issue
Block a user