adding --reset option

v0.2.4
alseambusher 2016-12-16 21:54:38 +05:30
parent 853b7dc2af
commit 365051752a
3 changed files with 24 additions and 3 deletions

View File

@ -9,7 +9,7 @@ This is usually because the place where your crontab-ui is installed does not gi
__Hosting crontab-ui : it works on localhost but not outside the server__ - You have to host it using nginx, apache2, etc. Refer [this](nginx.md). __Hosting crontab-ui : it works on localhost but not outside the server__ - You have to host it using nginx, apache2, etc. Refer [this](nginx.md).
__crontab-ui stopped working__ - It can happen that your crontab-ui can stop working for some reason like adding incorrect jobs or timings. In order to fix it, you can just go ahead a remove the job from `crontab.db` or `env.db` in "crontabs" folder and restart crontab-ui. __crontab-ui stopped working__ - It can happen that your crontab-ui can stop working for some reason like adding incorrect jobs or timings. You can try resetting crontab-ui by running `crontab-ui --reset`.
__Where is my root node_modules folder__ - You can find it by `npm root -g` __Where is my root node_modules folder__ - You can find it by `npm root -g`

21
app.js
View File

@ -194,6 +194,27 @@ app.listen(app.get('port'), function() {
console.log("Attempted to autosave crontab"); 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')); console.log("Crontab UI is running at http://localhost:" + app.get('port'));
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "crontab-ui", "name": "crontab-ui",
"version": "0.2.3", "version": "0.2.4",
"description": "Easy and safe way to manage your crontab file", "description": "Easy and safe way to manage your crontab file",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {