pull/224/merge
Krisztian Korosi 2023-01-09 19:41:59 +00:00 committed by GitHub
commit e8feb75b18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

9
app.js
View File

@ -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
// we do this by watching log file and setting a on change hook to it
if (process.argv.includes("--autosave") || process.env.ENABLE_AUTOSAVE) {
crontab.autosave_crontab(()=>{});
fs.watchFile(crontab.crontab_db_file, () => {
crontab.autosave_crontab(()=>{
console.log("Attempted to autosave crontab");
});
fs.watchFile(crontab.crontab_db_file, (curr, prev) => {
if (curr.mtime === prev.mtime) {
return;
}
crontab.autosave_crontab(()=>{
console.log("Attempted to autosave crontab");
});

View File

@ -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');
var db = new Datastore({ filename: exports.crontab_db_file});
db.persistence.setAutocompactionInterval(30000);
var cronPath = "/tmp";
if(process.env.CRON_PATH !== undefined) {
console.log(`Path to crond files set using env variables ${process.env.CRON_PATH}`);