Skip to content

Instantly share code, notes, and snippets.

@kerasai
Last active November 29, 2018 17:36
Show Gist options
  • Save kerasai/12d4f74b146bf2eeaa50a3a26a8c94f5 to your computer and use it in GitHub Desktop.
Save kerasai/12d4f74b146bf2eeaa50a3a26a8c94f5 to your computer and use it in GitHub Desktop.
Repeat a migration when it fails due to not enough memory (Drupal, Pantheon, Terminus)
#!/usr/bin/env bash
# Adjust as needed to run desired migration in desired multidev.
SITE_ID=[site_env]
MIGRATION=[migration_id`]
CONTINUE=0
while [ $CONTINUE -eq 0 ]
do
echo "Running migration command..."
terminus drush ${SITE_ENV} -- mim --feedback=100 ${MIGRATION} > /tmp/migrate-result.txt
grep "not enough" /tmp/migrate-result.txt > /dev/null
CONTINUE=$?
done
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment