Skip to content

Instantly share code, notes, and snippets.

@nemke82
Created January 14, 2018 15:18
Show Gist options
  • Save nemke82/c13cf49b264e72bd31bd8701a4904d96 to your computer and use it in GitHub Desktop.
Save nemke82/c13cf49b264e72bd31bd8701a4904d96 to your computer and use it in GitHub Desktop.
async-reindex-m2.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd qw( abs_path );
use File::Basename qw( dirname );
my $pwd = dirname(abs_path($0));
my @indexers = `/usr/bin/php70 $pwd/bin/magento indexer:info | awk {'print \$1'}`;
my $count = @indexers;
my $i = 0;
foreach my $indexer(@indexers) {
print "Starting $indexer in Screen\n";
`/usr/bin/screen -mdS screen$i /usr/bin/php70 $pwd/bin/magento indexer:reindex $indexer`;
$i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment