So these are instructions for setting up a cron job on your localhost using MAMP on a Mac.
- In Terminal type crontab -e. This allows you to add a cron job, using the vim editor.
- Press i on your keyboard to go into vim's insert mode.
- Type in you cron command. For example, to run at minute 5 of every hour using curl, use:
5 * * * * /usr/bin/curl --silent --compressed http://localhost:8888/cron.php
But to run every 5 minutes, use:*/5 * * * * /usr/bin/curl --silent --compressed http://localhost:8888/cron.php
Note that if you are not using MAMP's default 8888 port, you should leave that off. - Press escape key to exit vim's insert mode.
- Type ZZ (Must be capital letters -- saves the file and exits crontab).
- Verify the cron job details by typing crontab -l (that's a lower case L) at the terminal prompt.
I recommend that you first try setting the job to run every 1 minute (with */1), so that you can check, reasonably quickly, that it is running. Then edit crontab again and change the curl command to your preferred time.
P.S. This is basically copied from this source, but I might need this info later again, so - easier for me to find it..