I have created a component that creates a content every hour. It will call itself once it is executed (Loop every Hour).
I can manually execute this component, and got the result I want, however, when I leave the job to the scheduler, it is not executed at the scheduled time.

I am new to Drupal, so if anyone can please provide me detailed steps to make this work.
Greatly appreciated.

Comments

mitchell’s picture

Status: Active » Postponed (maintainer needs more info)

You'll need to setup cron so that the scheduled tasks will be run automatically.

Cron runs on your server in the background and, at regular intervals, checks if there are any jobs in the queue. So, a scheduled job will wait until the next cron run to check for jobs that are set to be run at that time or earlier.

You can setup finer-grained controls of which module's cron jobs to check at an interval that's less frequent than every cron run using /project/elysia_cron. This is an optimization that you can use later, but it isn't required for setting it up.

If you want to run cron manually, it can be triggered by requesting a URL your site's cron url, available in 'admin/config/system/cron'. Or, you can use 'drush cron'.

Did that answer your question? If so, could you please change the status to "fixed"?

shengjundong89’s picture

Status: Postponed (maintainer needs more info) » Fixed
shengjundong89’s picture

Status: Fixed » Postponed (maintainer needs more info)

Hey mitchell,

Sorry I need to bother you again.

I'm using elysia_cron, and I set up my "rules_scheduler_cron" to run at (*/5 * * * *) which means every 5 minute correct?
However, after 5 minute, it didn't run at all.

I know my scheduler and component works because when I hit run manually, it will execute the desire task.

I felt like I am still missing something.

Please help.

shengjundong89’s picture

Status: Postponed (maintainer needs more info) » Active
thekevinday’s picture

(an alternative to elysia_cron is ultimate_cron.)

I am also having trouble with what appears to be scheduled tasks not running.
The ultimate_cron was able to give me more fine-grained error reports than the drupal core cron.

I get the following error message:

Notice: unserialize(): Error at offset 23 of 26 bytes in rules_scheduler_run_task() (line 61 of /var/www/drupal/sites/all/modules/rules/rules_scheduler/rules_scheduler.module). Call to a member function restoreBlocks() on a non-object (line 62 of /var/www/drupal/sites/all/modules/rules/rules_scheduler/rules_scheduler.module).
linus79’s picture

I had the same problem, I resolved installing Ultimate Cron

dixon_’s picture

elysia_cron or ultimate_cron are often complicated to set up or quite error prone. So I've created a better solution by integrating Rules Scheduler with Drush: #2089437: Drush integration for executing Rules Scheduler tasks.

With this you can set up a separate cron job on your server that runs this command more frequently than Drupal's normal cron task.

TR’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Summary of this old issue:

The original poster @shengjundong89 said the scheduled tasks were working properly when cron was triggered manually. In #1 @mitchell suggested that cron wasn't running, and I believe that to be the case. In #3 @shengjundong89 said elysia_cron was set up with the schedule "*/5 * * * *", which isn't a valid crontab entry, so I don't know exactly how the setup was done or whether it was ever working. A simple check in the dblog would tell you whether cron was actually running. No further information was provided. I don't know why this wasn't debugged with normal cron - adding elysia_cron into the mix just confuses the situation and makes it harder to resolve.

In #5 @thekevinday reports an unserialize() error with scheduled tasks. Although he doesn't mention it, I can see from his past posts that he's using PostgreSQL. There is a known problem with scheduler if you're using PostgreSQL, and that problem is discussed and solved in #1627174: Error in rules Scheduler module on PostgreSQL.

In #6 @linus79 says that *uninstalling* ultimate_cron solved the problem. So again not a Rules problem.

@dixon_ in #7 gave some helpful information.

It's been more than 5 years since the last post in this thread and the only unresolved issue is the original poster's, but there is no indication that this is anything but a configuration problem on the original poster's part.

If someone is still encountering this issue with the current version of Rules, please open a NEW issue with the specifics to your problem as well as steps you have take to debug. In particular, confirm that cron is running properly and let us know how you determined that cron is running properly on your site.