diff --git a/README/issues.md b/README/issues.md index 8aba6db..9389b1f 100644 --- a/README/issues.md +++ b/README/issues.md @@ -4,12 +4,12 @@ Issues You can submit issues in the [issue tracker](https://github.com/alseambusher/crontab-ui/issues) of the repository. ###Common issues -__crontab-ui is running but is not accessible on browser__ - +__crontab-ui is running but is not accessible on browser__ - This is usually because the place where your crontab-ui is installed does not give access to others. It can be resolved by either giving permission to the user (Recommended) or running crontab-ui as root. Refer [this](https://github.com/alseambusher/crontab-ui/issues/8) __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` diff --git a/app.js b/app.js index e95ee28..76e417c 100755 --- a/app.js +++ b/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')); }); diff --git a/package.json b/package.json index b44ac90..d4ea1ef 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crontab-ui", - "version": "0.2.3", + "version": "0.2.4", "description": "Easy and safe way to manage your crontab file", "main": "index.js", "scripts": {