diff --git a/crontab.js b/crontab.js index d9a60f1..ca4aba8 100644 --- a/crontab.js +++ b/crontab.js @@ -39,6 +39,7 @@ crontab = function(name, command, schedule, stopped, logging, mailing){ if (!mailing) mailing = {}; data.mailing = mailing; + data.running = 0; return data; }; @@ -98,14 +99,18 @@ exports.runjob = function(_id) { crontab_job_string_command = add_env_vars(env_vars, crontab_job_string_command) console.log("Running job") - console.log("ID: " + _id) + console.log("ID: " + _id) console.log("Original command: " + res.command) console.log("Executed command: " + crontab_job_string_command) + res.running = 1; + db.update({_id: _id},{$set: {running: res.running, saved: false}}); exec(crontab_job_string_command, function(error, stdout, stderr){ if (error) { console.log(error) } + res.running = 0; + db.update({_id: _id},{$set: {running: res.running, saved: false}}); }); }); }; diff --git a/public/js/script.js b/public/js/script.js index 8b4791b..c1fe5ed 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -60,7 +60,6 @@ function runJob(_id){ $.post(routes.run, {_id: _id}, function(){ location.reload(); }); - }); } diff --git a/views/index.ejs b/views/index.ejs index db8333c..5dea388 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -19,6 +19,27 @@ $("#env_vars").val(`<%- env %>`); }) +
<%- include('navbar.ejs') -%> @@ -83,9 +104,20 @@