Run multiple Magerun instances at once

In the past I already wrote articles about the very genius tool Magerun from Netz98, that I nearly use on every Magento project.

Recently I had the challenge to run three instances of Magerun on the same physical server with only one shell account. This was necessary because I ordered a big cluster from maxcluster for a staging environment for multiple Magento projects. Therefore I got only one single ssh account to maintain all projects via ssh.

Luckily I always use bash aliases to shorten my calls for complex shell commands.

So I could easily implement these three bash aliases in my ~/.bash_profile file on the server (or~/.profile, ~/.bash_aliasses, … -> depends on Linux version):

alias php="/usr/bin/php"
alias magerun_project1="php /var/www/share/project1_magento_root/path/to/magerun/n98-magerun.phar --root-dir=/var/www/share/project1_magento_root/current/mage/"
alias magerun_project2="php /var/www/share/project2_magento_root/path/to/another_magerun/n98-magerun.phar --root-dir=/var/www/share/project2_magento_root/current/mage/"
alias magerun_project3="php /var/www/share/project3_magento_root/path/to/another_another_magerun/n98-magerun.phar --root-dir=/var/www/share/project2_magento_root/current/mage/"

That’s it! As you can see, there are three new commands, that call different Magerun instances at different paths in the file system. With the help of the –root–dir  parameter the distinct  Magerun instance knows wich Magento should be used for its operations.

Further information on Magerun:

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.