Unfinished, do not pull.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
const cron = require('node-cron');
|
||||
|
||||
async function cronjob() {
|
||||
cron.schedule('* * * * * *', async () => {
|
||||
//run every .js file in the crons folder
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const normalizedPath = path.join(__dirname, './crons');
|
||||
fs.readdirSync(normalizedPath).forEach((file) => {
|
||||
require(`./crons/${file}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = cronjob;
|
||||
Reference in New Issue
Block a user