Server code script execution can be scheduled via the job scheduler. Switch to the Server Code > Jobs tab to open the scheduler.
You can set schedule parameters for script execution by using the convenient Schedule Builder. From the drop-down list to the right of the Script label, choose the script that should be scheduled and specify the time parameters:
If the parameters are specified like the screenshot above, the script will be executed every Monday, eight times from 10.30 to 17.30 (every hour). The execution time can be also set by using the schedule expression.
Choose Schedule expression to the right of the Use label, and provide the Cron expression based on Quartz:
For example, the 30 15 ? ** expression will execute the script at 15.30 every day.
One important thing to know is that the Appery.io job scheduler doesn’t use a seconds parameter in Cron expressions. So, if you use an expression such as 0 0/5 * * * ? you’ll get an error.
Remove the first number (zero in this case) and the expression will be correct.
There is a limitation of a minimum interval between scripts invocation based on your plan. The error will appear if the specified interval is less than the time span for your plan.
Once the schedule parameters are set, either by using the schedule builder or a correct schedule expression, click Save to schedule the execution. The scheduled script name and other parameters will be shown at the bottom of the page.
Click Refresh to see the executed scripts and their result status.
Toggle the on\off button in the Active column to pause the script execution:
When the script execution is paused, the time passed is saved. For example, let's say that the script should be executed every 5 minutes. If the script was paused after 3 minutes passed when the script is resumed it will be executed after 2 minutes.
Updated almost 3 years ago