adding --reset option

This commit is contained in:
alseambusher
2016-12-16 21:54:38 +05:30
parent 853b7dc2af
commit 365051752a
3 changed files with 24 additions and 3 deletions

21
app.js
View File

@@ -194,6 +194,27 @@ app.listen(app.get('port'), function() {
console.log("Attempted to autosave crontab");
});
});
}
if (process.argv.includes("--reset")){
console.log("Resetting crontab-ui");
let crontabdb = __dirname + "/crontabs/crontab.db";
let envdb = __dirname + "/crontabs/env.db";
console.log("Deleting " + crontabdb);
try{
fs.unlinkSync(crontabdb);
} catch (e) {
console.log("Unable to delete " + crontabdb);
}
console.log("Deleting " + envdb);
try{
fs.unlinkSync(envdb);
} catch (e) {
console.log("Unable to delete " + envdb);
}
crontab.reload_db();
}
console.log("Crontab UI is running at http://localhost:" + app.get('port'));
});