17 lines
430 B
TypeScript
17 lines
430 B
TypeScript
import { CronJob } from "cron";
|
|
import { WaterMeService } from "actions/waterMe/waterMe.service";
|
|
|
|
const waterMeService = new WaterMeService();
|
|
|
|
new CronJob(
|
|
"0 0 0 */1 * *", // cronTime
|
|
async () => {
|
|
console.log("isThirsty()");
|
|
await waterMeService.isThirsty();
|
|
}, // onTick
|
|
null, // onComplete
|
|
true, // start
|
|
"Europe/Berlin", // timeZone
|
|
);
|
|
// job.start() is optional here because of the fourth parameter set to true.
|