How To Build A Cron Job

12 Views
Published
How to create a custom cron job.
Log into your server via ssh using the shell user you wish to create the cron job under.

Once logged in, run the following command to open your crontab file: crontab space dash e

You are then asked to choose an editor to view this file. Number 6 uses the program Nano, which is the easiest option.

View the creating and editing a file via ssh article linked in the description box below for more details on how to use Nano. https://help.dreamhost.com/hc/en-us/articles/115006413028-Creating-and-editing-a-file-via-SSH

You are now presented with this new crontab file, at the bottom add the code for your cron job. This example runs a file named mail.php under the username. This should be the same username that you're currently logged in under.

This example also runs the cron job at 8:13 pm.
Now, save the file. You should see the following response, “crontab installing new crontab”
The crontab should now run every day at 8:13 pm.

For more helpful tips and tricks visit dreamhost.com/academy and to open a DreamHost web hosting account check out dreamhost.com!
Category
DreamHost
Tags
how to build a cron job, how to create a custom cron job, how do i make a custom cron
Be the first to comment