diff --git a/README.md b/README.md index b7baf73..1dd77a1 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Crontab UI Editing the plain text crontab is error prone for managing jobs, e.g., adding jobs, deleting jobs, or pausing jobs. A small mistake can easily bring down all the jobs and might cost you a lot of time. With Crontab UI, it is very easy to manage crontab. Here are the key features of Crontab UI. +![flow](http://alseambusher.github.io/files/flow.gif) + 1. Easy setup 2. Easy and safe adding, deleting or pausing jobs. Easy to maintain hundreds of jobs. 3. Backups diff --git a/crontab.js b/crontab.js index 36df016..6b5c6a0 100644 --- a/crontab.js +++ b/crontab.js @@ -71,5 +71,9 @@ exports.backup = function(){ exports.restore = function(db_name){ fs.createReadStream( __dirname + '/crontabs/' + db_name).pipe(fs.createWriteStream( __dirname + '/crontabs/crontab.db')); - db.loadDatabase(); + db.loadDatabase(); // reload the database +} + +exports.import = function(){ + //TODO } diff --git a/public/js/script.js b/public/js/script.js index 9db4165..49ac907 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -63,7 +63,7 @@ function editJob(_id){ if(job){ $("#job").modal("show"); $("#job-name").val(job.name); - $("#job-command").val(job.command.replace("\"","\\\"")); + $("#job-command").val(job.command); // if macro not used if(job.schedule.indexOf("@") != 0){ var components = job.schedule.split(" "); diff --git a/views/index.ejs b/views/index.ejs index 1c00ad5..3cbcbbf 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -11,8 +11,7 @@ $(function () { // initialize tooltips $('[data-toggle="tooltip"]').tooltip(); - // TODO handle the commands with quotes - crontabs = JSON.parse('<%- crontabs %>'); + crontabs = JSON.parse('<%- crontabs.replace(/\\\"/g,"\\\\\"") %>'); routes = JSON.parse('<%- routes %>'); }) diff --git a/views/popup.ejs b/views/popup.ejs index 224cede..77c5b1c 100644 --- a/views/popup.ejs +++ b/views/popup.ejs @@ -45,7 +45,7 @@

- Startup + Startup Hourly Daily Monthly diff --git a/views/restore.ejs b/views/restore.ejs index dcc1132..3eb9980 100644 --- a/views/restore.ejs +++ b/views/restore.ejs @@ -11,8 +11,7 @@ $(function () { // initialize tooltips $('[data-toggle="tooltip"]').tooltip(); - // TODO handle the commands with quotes - crontabs = JSON.parse('<%- crontabs %>'); + crontabs = JSON.parse('<%- crontabs.replace(/\\\"/g,"\\\\\"") %>'); routes = JSON.parse('<%- routes %>'); })