You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crontab-ui/restore.js

28 lines
650 B

10 years ago
//load database
var Datastore = require('nedb');
var crontab = require("./crontab");
var path = require("path");
10 years ago
var exec = require('child_process').exec;
var fs = require('fs');
exports.crontabs = function(db_name, callback){
var db = new Datastore({filename: path.join(crontab.db_folder, db_name)});
10 years ago
db.loadDatabase(function (err) {
});
10 years ago
db.find({}).sort({ created: -1 }).exec(function(err, docs){
10 years ago
callback(docs);
});
8 years ago
};
10 years ago
exports.delete = function(db_name){
fs.unlink(path.join(crontab.db_folder, db_name), function(err){
if(err) {
return console.log("Delete error: " + err);
}
else{
console.log("Backup deleted");
}
});
8 years ago
};