import cron from 'node-cron' import { updateDBWithOnlineDevices } from './utils/wifiUtils' import { User } from './classes/User' console.log('Scheduling Tasks...') cron.schedule( '*/5 * * * *', async () => { console.log( 'cron exec: updateDBWithOnlineDevices started at' + new Date().toTimeString() ) await updateDBWithOnlineDevices() console.log( 'cron exec: updateDBWithOnlineDevices finished at' + new Date().toTimeString() ) }, {} ) cron.schedule( '0 0 0 * * *', async () => { console.log( 'cron exec: User.importAllUsers started at ' + new Date().toTimeString() ) await User.importAllUsers() console.log( 'cron exec: User.importAllUsers finished at ' + new Date().toTimeString() ) }, {} )