Answers.Body: <p>There are several solutions.  I'll go from least to most work - though the "least work" solutions generally need a level of expertise that the "most work" solutions don't.</p>
  
  <ul>
  <li>You can edit your <code>max_execution_time</code> in <code>php.ini</code>.</li>
  <li>The default execution time when running from the command line is unlimited.  So you could run <code>cv api Job.update_greeting</code> or the equivalent using <code>drush</code> or <code>wp-cli</code> if you don't have <code>cv</code> installed.</li>
  <li>Greetings are updated whenever a record is updated.  An easy way to batch update records is to import a list of all the contact IDs you want to update with no other info.  This will force an update and thus a greeting update.</li>
  <li>You can delete all your addressee values that need updating (or all of them!) through MySQL/phpMyAdmin, then use "Update Greetings" with a limit of 2500 and set <code>force</code> equal to 0.  With <code>force</code> equal to zero, only contacts without addressees will be updated, so you won't do the same 2500 every time.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-30T17:01:40.560Z
Answers.Text: Thanks for the detailed listing. The second option is appealing - I don't have cv installed but am running on Drupal. Do I need anything extra installed to use the Drush method?
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-31T16:09:49.683Z
Answers.Text: Nope - you might want to confirm that PHP has an unlimited `max_execution_time` on command-line, but assuming so, the command is just `drush civicrm api Job.update_greeting`.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-14T14:37:49.600Z
Answers.Text: We opted to try the drush option first - and it worked!! Some random tidbits for anyone that might happen across this post. I had to run the drush command as apache, it also required me to add the ct and gt parameters. My final command was(after telling it to run as apache) /path/to/drush civicrm-api Job.update_greeting ct=Individual gt=addressee force=1
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-30T16:56:32.607Z
Answers.LastActivityDate: 2018-08-30T16:56:32.607Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I have about 50,000 contacts to update and I have a scheduled update greeting job set up (based on this post <a href="https://civicrm.stackexchange.com/questions/24321/update-addressee-values-for-all-contacts-after-modifying-addressee-type-options">Update addressee values for all contacts after modifying Addressee Type Options</a> - thanks Sean!)</p>
  
  <p>If I run the scheduled job, it never completes (it hits a max execution time limit.) I did find that I can limit the number of contacts (to say 2500) with the limit parameter, and the job will complete. But my assumption is that if I run the job again it just updates my first 2500 contacts over again. Is that a correct assumption? </p>
  
  <p>Is there another way I can update the contact.addressee token in batches to avoid hitting the max execution time?</p>
  
Tags: <contacts><tokens><scheduled-job>
Title: Is there a way to update the contact.addressee field in batches?
ThreadText: # Is there a way to update the contact.addressee field in batches?
  
  (Asked by: username_0 on 2018-08-30)
  
  I have about 50,000 contacts to update and I have a scheduled update greeting job set up (based on this post [Update addressee values for all contacts after modifying Addressee Type Options](https://civicrm.stackexchange.com/questions/24321/update-addressee-values-for-all-contacts-after-modifying-addressee-type-options) - thanks Sean!)
  
  If I run the scheduled job, it never completes (it hits a max execution time limit.) I did find that I can limit the number of contacts (to say 2500) with the limit parameter, and the job will complete. But my assumption is that if I run the job again it just updates my first 2500 contacts over again. Is that a correct assumption?
  
  Is there another way I can update the contact.addressee token in batches to avoid hitting the max execution time?
  
  **Tags:** contacts, tokens, scheduled-job
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-30. Score: 2 | Accepted answer
  
  There are several solutions. I'll go from least to most work - though the "least work" solutions generally need a level of expertise that the "most work" solutions don't.
  
  * You can edit your `max_execution_time` in `php.ini`.
  * The default execution time when running from the command line is unlimited. So you could run `cv api Job.update_greeting` or the equivalent using `drush` or `wp-cli` if you don't have `cv` installed.
  * Greetings are updated whenever a record is updated. An easy way to batch update records is to import a list of all the contact IDs you want to update with no other info. This will force an update and thus a greeting update.
  * You can delete all your addressee values that need updating (or all of them!) through MySQL/phpMyAdmin, then use "Update Greetings" with a limit of 2500 and set `force` equal to 0. With `force` equal to zero, only contacts without addressees will be updated, so you won't do the same 2500 every time.
  
  > **Comments:**
  > **username_0**: Thanks for the detailed listing. The second option is appealing - I don't have cv installed but am running on Drupal. Do I need anything extra installed to use the Drush method?  
  > **username_1**: Nope - you might want to confirm that PHP has an unlimited `max_execution_time` on command-line, but assuming so, the command is just `drush civicrm api Job.update_greeting`.  
  > **username_0**: We opted to try the drush option first - and it worked!! Some random tidbits for anyone that might happen across this post. I had to run the drush command as apache, it also required me to add the ct and gt parameters. My final command was(after telling it to run as apache) /path/to/drush civicrm-api Job.update_greeting ct=Individual gt=addressee force=1  
  
  ---
  
  