PDA

View Full Version : Help with Cron Jobs...


cmm324
01-14-2007, 09:47 AM
Hi all,
I am a convert from windows hosting, and I am not very skilled with linux or linux based hosting, so please be kind. :)

I installed SugarCRM and it requires me to create a cronjob. Here is the excerpt from the documentation.

_____________________________
To add a new cronjob to your crontab
1. At the command prompt, type crontab -e.
2. Enter the following line to your crontab:
* * * * * cd /path/to/sugar/crm; php -f cron.php > /
dev/null 2&>1
_____________________________

So I am thinking the command for the cron job should be the following?

* * * * * /usr/bin/php -q /home/{USERNAME}/public_html/crm/cron.php

Thank you in advance.

dkinzer
01-14-2007, 08:13 PM
* * * * * /usr/bin/php -q /home/{USERNAME}/public_html/crm/cron.php
If you could edit your crontab directly (you cannot), that might be the line to enter. I'm a bit suspicious about running the command each and every minute of every hour, every day, etc. (as that suggests) but that might be what is required.

Note, also, that the directions suggest that you should first change directories (the 'cd' part of the command). Depending on the particulars, that may or may not be required but if the script creator recommended it, it's probably necessary. For that to work, you must surround the entire series of commands with a pair of parentheses.

At BlueHost, you must use cPanel to add/edit cron jobs. In the 'System Tools' box (lower right) you'll find an entry for 'Cron jobs'. Click on that link. Next, you'll be presented with a page with two buttons: 'Standard' or 'Advanced (Unix Style)'. I prefer the latter but you can generally create the same effect no matter which you choose. Assuming that you chose the latter, you'll see a list of existing cron jobs (if there are any). In any event, you'll see a series of boxes with captions denoting different time elements. An asterisk means "all", otherwise, the cron command will be run at the corresponding time of day. Then, you fill in the command to be run. In your case, I would suggest using exactly what was recommended with the addition of the parentheses:

(cd /home/{USERNAME}/public_html/crm; /usr/bin/php -q cron.php > dev/null 2&>1)