Scheduling a task to run automatically
How to set up a cron job that runs a script on its own schedule.
A scheduled task runs a command on its own, on a timetable you set, with nobody needing to trigger it by hand. It's the usual way to run things like a daily database cleanup, a script that sends a recurring report, or a task an application's own documentation asks you to run periodically.
Steps
- Click Cron Jobs in the sidebar, under Advanced.
- Under Schedule, either pick one of the ready-made options (every 5 minutes, hourly, daily at 03:00, weekly, monthly, or at boot) or type your own if you need something more specific.
- Under Command, type the full command to run, for example the path to a PHP script you want executed.
- Optionally, enter an email address to receive the task's output each time it runs. Leave it blank to run silently.
- Save it. The task starts running on its own schedule from then on.
Tip: if a task doesn't seem to be running, double-check the command works when you type it yourself in the terminal first. A command that only works from your own computer, or that depends on something not present on this server, will fail here the same way.