I've had success using the package cron
. It's simple to use and is generally compatible with a CronTab. I've had a job that runs once a month and this has worked consistently since last year, so I can attest to it.
That being said, this package ultimately does just use setTimeout
internally so there's no real issue with you doing that. If your timeout number is too large (larger than the maximum JavaScript integer) there may be a problem, but 1000 * 60 * 60 * 24
is significantly smaller than that.
Obviously if your system goes down or the script crashes for some other reason the timeout won't work.
You could also just use crontab
directly if it's available (or Windows task scheduling).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…