17 lines
428 B
TypeScript
17 lines
428 B
TypeScript
import { CronJob } from "cron";
|
|
import { GreetingService } from "services/greeting.service";
|
|
|
|
const greetingService = new GreetingService();
|
|
|
|
new CronJob(
|
|
"0 */1 * * * *", // cronTime
|
|
async () => {
|
|
console.log("called greeting");
|
|
await greetingService.greet();
|
|
}, // onTick
|
|
null, // onComplete
|
|
true, // start
|
|
"Europe/Berlin", // timeZone
|
|
);
|
|
// job.start() is optional here because of the fourth parameter set to true.
|