How to implement Scheduled Scripts
-
I'm a bit new to server stuff and am having trouble with understanding how to schedule a script to run weekly. I want to send each user an email of their weekly progress.
I have it currently set up to send them an email once a week by checking when the leaderboard needs to be reset. But this is not using cloud code scripting and they are required to open the app (which then checks the leaderboard reset time, which triggers a email to be sent) to do this. Is there any clear explanation setting up scheduling scripts and having them automatically repeat weekly?
Thanks -
Hi,
The general approach is to have your script re-schedule itself immediately when it runs (before it does the rest of it's processing).
So then - you just schedule it to run the first time... and each time it runs it re-schedules itself to run again.
You want to re-schedule the script immediately before you do the rest of the processing - so that if there happens to be an error in your script - the rescheduling still happens... (otherwise your weekly cycle would stop).
I hope that helps!
Paul.
-
T tristan has marked this topic as solved on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login