ASU Web Community

Setting up cron for Drupal

Wednesday, September 5th, 2007 - 8:59 am
  • bbailey1
  • bbailey1's picture

Is there anyone out there with knowledge of setting up cron to run the cron.php file within drupal?

Wednesday, September 5th, 2007 - 12:58 pm
  • cscholtz
  • cscholtz's picture

I might be able to help. First create a new file drupalcron.sh. Open in a text editor and add the code in blue (change "myweb" to your site name):

#!/bin/sh
/usr/bin/lynx -dump -accept_all_cookies 'http://myweb.asu.edu/cron.php'

  1. Upload drupalcron.sh to your \scripts directory. Note this is a top-level directory. Create it if necessary. It needd 755 permissions.
  2. Sign into DirectAdmin.
  3. Go to your account and click on the Files icon at the top of the page. Check the permissions on the \scripts directory. Change to 755 if necessary.
  4. Click on the Home icon at the top of the page. At the bottom of the home page you should see an Advanced Features section. Click on the Cronjobs link.
  5. Enter the minutes, hours, months, week, etc., and the path to your drupalcron.sh file you just uploaded. For example: Enter "15,45" in the Minutes box and this line in the Command box:
    /home/usi/scripts/drupalcron.sh
  6. Click the add button. Then go into Drupal. Under Administer\Logs\Status Report you can check the status of your cron job.

cheers,

Cameron

Wednesday, September 5th, 2007 - 1:53 pm
  • bbailey1
  • bbailey1's picture

Thanks for the quick responses!!

I have set up the cronjobs as specified above, however I am still not seeing the status of my cron jobs change within drupal. I do have multiple domains in my DirectAdmin account, does that have any bearing on the settings?

Thanks again!

Bill

Wednesday, September 5th, 2007 - 1:02 pm
  • cphill

If you're using the ASU webhosting, you should be able to configure your cron jobs through DirectAdmin (the link is located at the bottom left under "Advanced Features" - it's a pretty simple GUI.

 

Thursday, September 6th, 2007 - 10:05 am
  • bbailey1
  • bbailey1's picture

Thanks again to everyone for their help!

If anyone is looking for the solution to this problem...

  1. in DirectAdmin, under cronjobs, set the minutes to the time you want to run the job. For example: 15 will run the job on the 15th minute of every hour
  2. the command line is:

    wget -q http://mysite.asu.edu/cron.php

    where mysite is the name of your site, (this is assuming that you have drupal installed in your root directory.

There you have it!