Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am running a script which Fetches the data from other site like Articles of a user and other things also. I run my script in hook_cron. Cron gives me this error after a while of script running.

Cron run exceeded the time limit and was aborted.

Also I don't have access to change php.ini and setting.php. How can I change max_exec_time value.

share|improve this question
    
If you don't have access to anything that can change the max execution time, then you can't really change the max execution time. Have you tried the Batch API for your cron tasks? Might be worth splitting the task up to prevent timeouts. –  Chapabu Dec 17 '12 at 15:49
    
There's some more advice for using the Batch API in hook_cron here. –  Chapabu Dec 17 '12 at 15:50
add comment

3 Answers

Seeing as you don't have access to anything that allows you to change the max execution time (and I would imagine if you find a workaround that it won't work if your server is this locked down) I see a couple of options.

1: Utilise the Batch API as I mentioned in my comment (Batch API docs are here)

2: Check out Elysia Cron to split your cron tasks up into smaller, more manageable chunks.

Elysia Cron extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.

share|improve this answer
    
This is a much better idea than the nonsense I was spouting :) –  Clive Dec 17 '12 at 15:54
1  
I know this from personal experience :p On my live box if I try to change anything with ini_set outside of settings.php or php.ini then it won't actually work :( –  Chapabu Dec 17 '12 at 15:57
    
@Chapabu I can't use Elysia Cron with poorman cron. Because Most of things are setup with poorman cron. I will check the Batch API. I didn't know anything about batch api so I have to read it first. –  Sumit Madan Dec 17 '12 at 15:58
    
@Sumit Drupal also has built-in queue handling for cron jobs, check out hook_cron_queue_info() –  Clive Dec 17 '12 at 16:00
    
@SumitMadan That's a shame. Apparently Ultimate Cron works with Poormanscron, but I've never tried it, so I can't offer anything else other than the name. –  Chapabu Dec 17 '12 at 16:02
show 6 more comments

.htaccess is another option for increasing max_execution_time, if you have access to that. See http://stackoverflow.com/questions/7739870/increase-max-execution-time-for-php.

share|improve this answer
    
not have access –  Sumit Madan Dec 18 '12 at 6:21
add comment
up vote 0 down vote accepted

Contacted to my client and get Access to files.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.