Merge dd4546f250
into c69ef51a04
commit
e8feb75b18
9
app.js
9
app.js
|
@ -271,8 +271,13 @@ server.listen(app.get('port'), app.get('host'), function() {
|
||||||
// If --autosave is used then we will also save whatever is in the db automatically without having to mention it explictly
|
// If --autosave is used then we will also save whatever is in the db automatically without having to mention it explictly
|
||||||
// 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") || process.env.ENABLE_AUTOSAVE) {
|
if (process.argv.includes("--autosave") || process.env.ENABLE_AUTOSAVE) {
|
||||||
crontab.autosave_crontab(()=>{});
|
crontab.autosave_crontab(()=>{
|
||||||
fs.watchFile(crontab.crontab_db_file, () => {
|
console.log("Attempted to autosave crontab");
|
||||||
|
});
|
||||||
|
fs.watchFile(crontab.crontab_db_file, (curr, prev) => {
|
||||||
|
if (curr.mtime === prev.mtime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
crontab.autosave_crontab(()=>{
|
crontab.autosave_crontab(()=>{
|
||||||
console.log("Attempted to autosave crontab");
|
console.log("Attempted to autosave crontab");
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@ exports.env_file = path.join(exports.db_folder, 'env.db');
|
||||||
exports.crontab_db_file = path.join(exports.db_folder, 'crontab.db');
|
exports.crontab_db_file = path.join(exports.db_folder, 'crontab.db');
|
||||||
|
|
||||||
var db = new Datastore({ filename: exports.crontab_db_file});
|
var db = new Datastore({ filename: exports.crontab_db_file});
|
||||||
|
db.persistence.setAutocompactionInterval(30000);
|
||||||
var cronPath = "/tmp";
|
var cronPath = "/tmp";
|
||||||
if(process.env.CRON_PATH !== undefined) {
|
if(process.env.CRON_PATH !== undefined) {
|
||||||
console.log(`Path to crond files set using env variables ${process.env.CRON_PATH}`);
|
console.log(`Path to crond files set using env variables ${process.env.CRON_PATH}`);
|
||||||
|
|
Loading…
Reference in New Issue