简体   繁体   English

Sails js-每次检查数据库

[英]sails js - check database every time

I have a schedule manager web application where the system will check every hour if current time is passing the due date that stored in database and will send an email if the current time pass the due date even if the user doesn't open the web app. 我有一个调度管理器Web应用程序,该系统将每小时检查当前时间是否超过了存储在数据库中的到期日期,并且即使用户没有打开Web应用程序,如果当前时间超过了到期日期,系统也会发送一封电子邮件。 。 Can sails js alone do something like this? 可以独自航行js做这样的事情吗?

You'll probably want to schedule a cron job which executes a script at a set interval to do this for you. 您可能需要安排一个cron作业,该作业以固定的时间间隔执行脚本来为您执行此操作。

You can read up on cron and decide what works best for you; 您可以阅读cron并确定最适合您的方法; in general you'll probably want to have a separate script that is executable from the command line (such as a send_emails.js which you can execute with node send_emails.js ). 通常,您可能希望有一个可从命令行执行的单独脚本(例如send_emails.js ,可以与node send_emails.js执行)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM