[support] Setting up cron job for user role updates

Victor Kane victorkane at gmail.com
Fri Mar 9 11:29:15 UTC 2007


It's always been my wish to run an ESL site!
I taught ESL for many years until getting into IT in the late eighties. My
whole purpose of getting into IT was to seek help for my teaching academy,
but once in the new realm, I was caught up entirely by it :)

So I certainly would like to help you.

Running cron is part of the realm of the operating system, outside of
Drupal.

Your hosting company will allow you to edit cron via a panel; they may force
you to edit cron directly through text you enter, or they may have some kind
of interface to make life easy for you.

If that is not the case, then you will have to fill in something like the
following:

# m h  dom mon dow   command
0   3   *   *   *   wget -O - -q http://mentor/drupal/cron.php

Please see the excellent documentation on the Drupal site at
http://drupal.org/cron which explains all and gives alternatives to wget.
There are also instructions for certain hosting companies like Dreamhost,
etc. Check out the comments at the bottom of the page for some illuminating
explanations.

Drupal has a poormanscron module, but I would recommend running cron
directly.

Once you have done this, you can now enable the core search module which
will index your site, and you will be able to supplement the pearl script
you are currently using with Drupal's powerful built-in search facilities.

You should do this first, at least for testing purposes, to make sure you
have cron running.

For your second step, you need to write a module which implements
The file cron.php invoked by cron calls
http://api.drupal.org/api/5/function/drupal_cron_run and this  some
housekeeping and then invokes all module implementations of hook_cron().

The search module, for example, does the following:

/**
 * Implementation of hook_cron().
 *
 * Fires hook_update_index() in all modules and cleans up dirty words (see
 * search_dirty).
 */
function search_cron() {
  // We register a shutdown function to ensure that search_total is always
up
  // to date.
  register_shutdown_function('search_update_totals');

  // Update word index
  foreach (module_list() as $module) {
    module_invoke($module, 'update_index');
  }
}

You would need to write a module which, in its modulename_cron() function
effectively iterates over the users and carries out the changes you propose.

Cheers,

Victor Kane
http://awebfactory.com.ar

On 3/9/07, Neil: esl-lounge.com <neil at esl-lounge.com> wrote:
>
>  Here is my wish: to run a cron job a few times a day to update all
> Authenticated Users to Full Members once they have posted five
> comments/forum posts.
>
> My plan is to have all comments posted by Authenticated Users moderated
> but move users up to the Full Members role I will create to cut down on
> moderation work. How would I go about doing this? Is there any documentation
> on drupal.org about setting up cron jobs? There don't seem to be any
> modules to allow this. Userpoints exists but isn't free. A simple cron job
> seems to be the easiest solution all round. Has anyone else put something
> like this in place?
>
> Neil
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070309/55d7df2e/attachment.htm 


More information about the support mailing list