reading from crontab db and populating UI

This commit is contained in:
Suresh Alse
2015-06-12 14:41:53 +05:30
parent e5b466aa50
commit 035d432b7a
6 changed files with 197 additions and 27 deletions

View File

@@ -6,8 +6,9 @@ db.loadDatabase(function (err) {
var exec = require('child_process').exec;
var fs = require('fs');
crontab = function(command, schedule, stopped){
crontab = function(name, command, schedule, stopped){
var data = {};
data.name = name;
data.command = command;
data.schedule = schedule;
data.stopped = stopped;
@@ -15,8 +16,8 @@ crontab = function(command, schedule, stopped){
return data;
}
exports.create_new = function(command, schedule){
var tab = crontab(command, schedule, false);
exports.create_new = function(name, command, schedule){
var tab = crontab(name, command, schedule, false);
db.insert(tab);
}
@@ -35,9 +36,8 @@ exports.set_crontab = function(){
}
});
fs.writeFile("/tmp/crontab", crontab_string, function(err) {
//couldnt write
exec("crontab /tmp/crontab");
});
exec("crontab /tmp/crontab");
});
}