You can have DreamHost automatically configure a cron job in the panel on the Cron Jobs page.
When creating the cron job, you must assign it to a shell user in your panel. Only shell users are able to run cron jobs.
Cron jobs can be created on any hosting plan.
Creating a cron job in the panel:
- Navigate to the Cron Jobs page.
- The 'Cron Jobs' page appears:
- Click the Add New Cron Job button
- The 'Creating New Cron Job' page opens:
- To create the cron, fill in the following fields:
- User: From the dropdown menu choose an existing shell user you'd like the cron job to run under.
- Title: Give the cron job a name you'll remember.
- Email output to: Enter an email address you'd like to receive the cron output to. You can also leave this blank to not receive emails.
- Command to run: Enter the command to run.
The command you enter usually must first specify the path to the program you'd like to use to run the cron job. View the 'Paths to common programs' below for examples. For example let's say you have a PHP file named script.php in your domains directory:
To run this command you'd enter the path to your chosen version of PHP followed by a space, followed by the path to the file:
- /usr/local/php71/bin/php /home/username/example.com/script.php
- Use locking: Enabling this if you want to prevent the job from running more than once at a time.
- When to run: From the dropdown menu, choose how often you'd like this job to execute.
The time you choose should be PDT/PST since this is the timezone your webserver is set to. To figure out the correct time you can either log into your server via SSH and run the command date, or you can check a website that lists this information.
It's currently only possible to add 12 different minutes within an hour. You can arrange these how you like, but the cron can run no more than 12 times within a single hour.
Paths to common programs
Below are the paths to common programs on the server. This is the path you would add before the file you wish to run.