Schedule cron job
This commit is contained in:
parent
5681530a27
commit
0e58a4e12c
|
@ -149,8 +149,9 @@ END:VEVENT
|
||||||
icalString += `END:VCALENDAR`;
|
icalString += `END:VCALENDAR`;
|
||||||
fs.writeFileSync(filename, icalString);
|
fs.writeFileSync(filename, icalString);
|
||||||
|
|
||||||
// Update the merged calendar URL
|
// Generate a unique URL for the merged calendar
|
||||||
const mergedCalendarUrl = `${req.protocol}://${req.get('host')}/${filename}`;
|
const mergedCalendarUrl = `http://localhost:3000/${filename}`;
|
||||||
|
console.log(`Merged calendar updated: ${mergedCalendarUrl}`);
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -168,7 +169,7 @@ setInterval(() => {
|
||||||
// Schedule a cron job to update the merged calendar every hour
|
// Schedule a cron job to update the merged calendar every hour
|
||||||
cron.schedule('0 * * * *', () => {
|
cron.schedule('0 * * * *', () => {
|
||||||
console.log('Updating merged calendar...');
|
console.log('Updating merged calendar...');
|
||||||
// TO DO: implement the logic to update the merged calendar
|
updateMergedCalendar();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
|
|
Loading…
Reference in New Issue