need Cron-ik

January 5, 2009 chrisyakimov

Tags: ,

I’m pretty sure that a bit o’ chronic would help with this (even though I never use the stuff), being rather illiterate in OS technologies and command line interfaces.  In any case, I seem to have set up the crontab on my OSX.  For future reference, this is how I did it.

! Important Points.

From gotDrupal.com:

  1. Cron is an old technology that can be harnessed by Drupal.  Cron.php is not that technology – it is a script that comes with drupal which allows Drupal’s modules to execute at scheduled times via some form of Cron technology.

From Lynda.com tutorials (if you’re logged in to Lynda.com, click here):

  1. Cron can be harnessed directly from the OS, or from the web via web-based cron services.
  2. If OS, cron can come in a number of forms depending on your OS. The three mentioned are wget, lynx, and curl.  These are cron programs that may be installed on your OS, and will most likely be accessed via command line. On Windows – use Scheduled Tasks.

My setup:

Mac OSX.
I need to use Terminal to figure out which cron to use.
Turns out I have CURL.

Instructions:

  1. Fire up Terminal (Applications >> Utilities >> Terminal)
  2. Use “whereis ____” to find the right cron.  Whereis lynx, whereis curl, whereis, wget.
  3. whereis curl should work, and should swtich to the directory in which it is located.
  4. Type: crontab -e.   This puts you into the crontab – the text file that will schedule cron via curl.  You’ll notice that Terminal has switched to a program called VI (“VIM”).
  5. Type the following: 45 * * * * <directory of curl> –silent –compressed  <directory of site’s cron script>
    So for me: 45 * * * * /usr/bin/curl –silent –compressed http://localhost/drupal/cron.php
  6. Hit ESC to get out of VI.
  7. Type :wq (I think that means save and quit).

Be Careful: that colon is crucial to being able to type again and not smash the keyboard, lol.

Entry Filed under: Uncategorized

2 Comments Add your own

  • 1. chrisyakimov  |  January 5, 2009 at 7:27 pm

    You can check under Admin >> Reports >> Recent Log Entries to see if Cron is firing. That 45 means it fires 45 minutes after the hour. Change it to a (*) to have it fire every minute. You’ll notice that it registers as “anonymous” in the log – that is because the action was not initiated from the admin account (as opposed to when you are logged in and type cron.php in the address bar, and the log registers it as being fired by “admin”)

  • 2. chrisyakimov  |  January 5, 2009 at 8:36 pm

    Turns out, according to: http://www.scottahearn.com/links_crontab.php, some webhosts are happy to allow you access to their crontab… so I guess I can ask our hosts about this…


Leave a Comment

Required

Required, hidden



Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to comments via RSS Feed

Pages

Categories

Calendar

January 2009
M T W T F S S
« Dec   Feb »
 1234
567891011
12131415161718
19202122232425
262728293031  

Most Recent Posts