|
|
@ -153,7 +153,7 @@ app.get(routes.restore_backup, function(req, res) {
|
|
|
|
|
|
|
|
|
|
|
|
// export current crontab db so that user can download it
|
|
|
|
// export current crontab db so that user can download it
|
|
|
|
app.get(routes.export, function(req, res) {
|
|
|
|
app.get(routes.export, function(req, res) {
|
|
|
|
var file = __dirname + '/crontabs/crontab.db';
|
|
|
|
var file = crontab.crontab_db_file;
|
|
|
|
|
|
|
|
|
|
|
|
var filename = path.basename(file);
|
|
|
|
var filename = path.basename(file);
|
|
|
|
var mimetype = mime.lookup(file);
|
|
|
|
var mimetype = mime.lookup(file);
|
|
|
@ -170,7 +170,7 @@ app.post(routes.import, function(req, res) {
|
|
|
|
var fstream;
|
|
|
|
var fstream;
|
|
|
|
req.pipe(req.busboy);
|
|
|
|
req.pipe(req.busboy);
|
|
|
|
req.busboy.on('file', function (fieldname, file, filename) {
|
|
|
|
req.busboy.on('file', function (fieldname, file, filename) {
|
|
|
|
fstream = fs.createWriteStream(__dirname + '/crontabs/crontab.db');
|
|
|
|
fstream = fs.createWriteStream(crontab.crontab_db_file);
|
|
|
|
file.pipe(fstream);
|
|
|
|
file.pipe(fstream);
|
|
|
|
fstream.on('close', function () {
|
|
|
|
fstream.on('close', function () {
|
|
|
|
crontab.reload_db();
|
|
|
|
crontab.reload_db();
|
|
|
@ -244,7 +244,7 @@ app.listen(app.get('port'), app.get('host'), function() {
|
|
|
|
// we do this by watching log file and setting a on change hook to it
|
|
|
|
// we do this by watching log file and setting a on change hook to it
|
|
|
|
if (process.argv.includes("--autosave")){
|
|
|
|
if (process.argv.includes("--autosave")){
|
|
|
|
crontab.autosave_crontab(()=>{});
|
|
|
|
crontab.autosave_crontab(()=>{});
|
|
|
|
fs.watchFile(__dirname + '/crontabs/crontab.db', () => {
|
|
|
|
fs.watchFile(crontab.crontab_db_file, () => {
|
|
|
|
crontab.autosave_crontab(()=>{
|
|
|
|
crontab.autosave_crontab(()=>{
|
|
|
|
console.log("Attempted to autosave crontab");
|
|
|
|
console.log("Attempted to autosave crontab");
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -252,8 +252,8 @@ app.listen(app.get('port'), app.get('host'), function() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (process.argv.includes("--reset")){
|
|
|
|
if (process.argv.includes("--reset")){
|
|
|
|
console.log("Resetting crontab-ui");
|
|
|
|
console.log("Resetting crontab-ui");
|
|
|
|
var crontabdb = __dirname + "/crontabs/crontab.db";
|
|
|
|
var crontabdb = crontab.crontab_db_file;
|
|
|
|
var envdb = __dirname + "/crontabs/env.db";
|
|
|
|
var envdb = crontab.env_file;
|
|
|
|
|
|
|
|
|
|
|
|
console.log("Deleting " + crontabdb);
|
|
|
|
console.log("Deleting " + crontabdb);
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|