I want to run cron.php as an authenticated drupal user. There are some feeds that need to be updated suring cron but just authenticated users have access to them. How do I set cron.php to run as authenticated user, not as anonymous?

Comments

ludo1960’s picture

Not sure I understand, but with Cpanel or webmin you can run cron as any user you want.

suaide’s picture

I want to run cron as a valid drupal user. For instance: I have a drupal instalation with the following users: user1, user2, user3. There are some content types that only user3 can access and cron needs to do something about them. In this case, drupal needs to think that cron is running as if user3 is looged (at drupal). If I read correctly, drupal cron runs as anonymous user, right? In this case, how do I authenticate drupal while running cron?

atang08’s picture

Such a silly reply @ludo1960

WorldFallz’s picture

Drupal 'cron' is just the menu callback that runs all the hook_cron defined code-- it doesn't run as any user.

suaide’s picture

Yes, but some stuff does not run if you are not authenticated. For instance: I have two sites. One of them has content that are visible only for authenticated users. It feeds another site. If I am authenticated I can get the feed for all the entries. But cron gets the feeds for non-protected entries. Entries that requires authentication does not get to the second site using cron. I what to change that.

ludo1960’s picture

Ok, not sure I undererstand. Are you saying you want to change the behaviour of the Drupal crop.php?

suaide’s picture

Yes.

I want to do the following:

I have two sites.

Site 1 has a calendar and some content on the calendar is restricted to some authenticated user.

Site 2 grabs the calendar content of site 1 using feed. I want to grab all the calendar content of site 1 to show in site 2, including the restricted content

Site 2 updates the calendar using cron. But it updates only the content that has no restriction access. I realized this is because cron runs as anonymous user for drupal.

I want cron to run as authenticated user in order to grab the content of the calendar from site 1.

But if I am following the wrong path and cron is not the answer, any help will do.

WorldFallz’s picture

Sorry-- i have no idea what you are talking about. again, afaik, cron has no concept of user-- authenticated or otherwise. Usually site admins run it via the *nix 'cron' command (hence the file name) which has nothing to do with drupal at all.

suaide’s picture

so, let me ask different:

How do I tranfer restricted content from one site to another using feed?

WorldFallz’s picture

Ah... that's a different question entirely and has nothing to do with cron. what you're looking for is some sort of access control rss mechanism. Checkout the http://drupal.org/project/securesite module.

suaide’s picture

Thanks. I will look into that.

ludo1960’s picture

I'm gonna look at that too!

atang08’s picture

Another silly reply @worldfallz

WorldFallz’s picture

and responding to a 6 year old thread to add not one, but TWO, comments that only say "silly reply"?

topfruit’s picture

Hi . Bit of a newbie. Am having the same problem in trying to run cron via webmin scheduling, and as this is unauthorised as far as my Drupal site is concerned, ut will not run, yet can be run manually when logged in as an authorised user. Did you manage to resolve the permissions issue?

topfruit’s picture

The devil as always is in the detail. The documentation details a third way of running Cron, by scheduling :-

"/full/path/to/drupal.sh --root /full/path/to/site/root/ http://default/cron.php"

This appears to resolve the issue - we'll see if it continues to work over the next few days!

Madbreaks’s picture

Makes perfect sense guys, jeez.

See the section titled "Running cron as an authenticated user" here:

http://drupal.org/cron

Cheers,

MB

nickl’s picture

It appears the page at alias http://drupal.org/cron has changed as it has no mention of "Running cron as authenticated user"

Rather try this node on for size: http://drupal.org/node/995514

Good luck! =)

rjacobs’s picture

A direct link to the page with the appropriate details is: http://drupal.org/node/23714

atang08’s picture

EXACTLY. It is clear! I don't know how @ludo1960 or @worldfallz got so confused. Was the question edited or something? Jeez. Such a waste of time reading through those replies.

Please delete the two first replies where they are clearly confused.

And thank you for your reply. That was much more helpful.

WorldFallz’s picture

we don't delete content in the forums unless it's spam or offensive. If you don't find something useful that fine-- but post not one but TWO comments only to add to the noise? really?

Jaypan’s picture

The irony of replying to what he claimed were silly replies, with silly replies, is not lost on me.

atang08’s picture

No its not spam or offensive, but useless.

If the point of these forums (especially when people ask questions) is to help those who are have questions, then deleting responses that have nothing to do with the OP's question makes some sense.

If those silly responses were deleted, it will prevent those who have the same problem from reading something that has nothing to do with the OP's question.

Jaypan’s picture

If you are unhappy with the support on these forums, I suppose you should ask for your fees to be refunded. Please note that that amount will be deducted from the wages of those who provide support here.