Scheduling a bit of code to run at specific times is a common requirement of most projects. With VPS services, you would SSH into your server and configure "cron jobs".
Servd make this a bit easier by allowing you to add "Scheduled Commands" directly in the dashboard:
Navigate to the "Scheduled Craft CLI Commands" section in your project's Staging or Production Commands page.
You should see all your active scheduled commands. To add a new one, input the command you'd like to run and the cron schedule pattern into the inputs under "Add a Command".
Click the "Add button".
When you're ready, sync your project to deploy the scheduled command to your environment.
Command Types #
Servd offers two types of scheduled commands:
- ./craft console commands.
- wget commands to make a web request to a specified URL.
Note: with both types you don't need to specify ./craft or wget as part of your command body.
Good To Know #
- The schedule pattern follows the widely-adopted crontab syntax.
- Commands can run at most once per 5 minutes.
- Scheduling times run against the UTC timezone.
- The number of scheduled commands you can have active at one time depends on your plan.