You've already forked crontab-ui
mirror of
https://github.com/alseambusher/crontab-ui.git
synced 2025-12-15 11:43:58 +08:00
adding --reset option
This commit is contained in:
21
app.js
21
app.js
@@ -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'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user