By django6 on
I have poormanscron installed, but I can't figure out how to configure how/when it runs cron. I doesn't seem to be listed where all the other modules are listed in sitebuilding or siteconfiguration. I even reinstalled it and enabled it again.
Comments
Permission issue?
Check if there are any permissions that you need to assign.
The configuration is now
The configuration is now located at the bottom of the admin/settings/site-information page.
Is that all there is to
Is that all there is to configuring it? Setting the interval to run cron on the site-information page?
I'd like to know how it decides to run cron. If I set the interval to 1 hr, is it going to run for any page load after 1 hour elapses? If the page is cached, will it then not run cron when visited? I was thinking I'd be able to set it to run cron, but only on specific pages.
.
Cron doesn't run on any particular pages. It is just the cron.php file included in Drupal, which runs all jobs specified by any Drupal modules.
In that respect, poormanscron does nothing less than a proper cron daemon running on the server. To run your own cron jobs you need to write a module which implements drupal's http://api.drupal.org/api/function/hook_cron/6 and they will be included.
My understanding was that
My understanding was that poormanscron ran cron.php when someone visited a page. So I just assumed you could set it to run cron when someone visited specific dynamic pages and not run cron when they visited other static pages. I have one page view that has specific events that expire and become unpublished --using the scheduler module. I want that page to get loaded after cron is run so the events that are expired will be removed. Maybe there's a better way?
I've never set up cron on a server, and I'm not sure my host allows it, but perhaps that is what I need to learn how to do. I've set up similar kinds of event listings using another cms called Expression Engine and it's very easy and nothing with cron is required for that. I'm kind of surprised I can't do something similar with Drupal.
.
Since poormanscron is not a daemon running continuously in the background but just a Drupal module, it needs something to happen to make it run and check if it is time to run the cron jobs.
Visiting a page is the event that triggers that. If nobody ever visits your site, poormanscron will never run the cron jobs.
You can read about setting up cron in http://drupal.org/cron
What if someone is visiting
What if someone is visiting the same page and their browser is showing the cached page (with now expired nodes). Is there any way to force the new page to be loaded with poormans cron or a cron job that's setup on the server?
I have another scenario where I want to list an item for sale for exactly 24 hours using Ubercart, but I want it to become immediately unpublished within seconds of the expired time. I'm not sure what the best way to approach this is.
.
Cron is about running scheduled jobs. Mostly maintenance jobs such as search indexing, sending out emails in medium-size batches to avoid flooding, cleaning up old logs etc. The schedules jobs are executed when the times comes and can't be rushed by any events. Also, cron's execution timing is not accurate and may depend on the server load.
In other words, cron is not the right tool for any of the tasks you described. There are other modules for that, for example
- the Trigger module included in core
- the more advanced http://drupal.org/project/rules module.
With these modules you can specify that when an event happens (a page visit, a node save, a user registration, a cron run etc...) an action should run (specified by a module or by some custom PHP code of yours, for example, to clear the cache).
About cached pages, of course you could just disable drupal's cache instead in admin/settings/performance. But authenticated users don't get cached content anyway.
About exact expire times, you can probably do that with triggers or rules as well, without any background daemon or timing mechanism. The trick is that it doesn't matter when exactly the auction is actually unpublished, but what you tell the first user who tries to access it after the expiration time. This visit can trigger a rule which unpublishes the auction and tells the user that it expired xxx seconds ago (just a calculation).
I was originally looking at
I was originally looking at triggers and rules, but wasn't sure how to use an expiration time as the event/trigger that unpublished and removed the node. I suppose the action of trying to purchase a product after the expiration could also be the trigger, but to me it makes more sense to have the expired time be the event/trigger. Is this easily done with Rules?
.
No, time doesn't trigger anything with Rules or any module.
Only cron or whatever scheduler your operating system uses can do that theoretically, if you add a new cron job to the operation system for every expiration time that you want to trigger an action. But as I said it is not accurate.
If cron is the only way to
If cron is the only way to trigger something base on time, and cron is not accurate, then how do you suppose people are creating products for sale that expire at an exact time. One example is http://www.woot.com which sells a product and has a ticking timer. When the 24 hours is up it's gone and a new product takes it's place. Auction sites must also have automated products that expire at a specific time, so there's got to be an accurate way to do it.
.
In the way I described in the previous reply, for example. On user access, read system time, compare with expiration, do what needs to be done, and you are still accurate to the millisecond no matter what, because you say (correctly) that the deal closed at the arranged time.
If you think of it, this is close to what happens in real life too. Nobody can pinpoint an exact point in time, they just realize that the time has expired.
The ticking system is usually javascript which starts running on the client computer when the user accesses the page.
I guess that sounds right.
I guess that sounds right. For instance, you can open a window in eBay to buy something, but if you click "submit bid" after the auction has ended, it will tell you you're too late. Also, if you access the url for the page after the bid has ended it will show an updated expired page.
So, I guess I was thinking wrongly that the time expiring was the event. The time is just a value that is compared with the system time to see if the auction is expired, but the event would be either clicking the "buy" button or visiting the page. I'm guessing the Rules module could handle this kind of logic?
.
Rules probably can. You will need to test it to make sure that some details are not missing.
Trigger: There is a "triggered action" named "Node: Content is going to be viewed". That sounds promising because the action must be done before viewing the page. I would test it to see how it handles anonymous users if caching is enabled.
Conditions: If the node has the right type, and if a field or a flag says that it is still open, and if the expiration time field has a value less that the current time, and if... whatever PHP code.
Action: Unpublish it or unflag it, run some PHP code to close it and wrap it up, clear the cache if needed or redirect... it may take some work to make everything behave properly.
Drupal 8
In Drupal 8, there is a analogous module called 'Automated Cron'