Installing n98-magerun

MageStack natively supports n98-magerun and comes with a built in installer for the tool, so that you can easily and quickly start administering your Magento store by command line.

Running in a Wrapper

As with all tools run by command line, they need to be run in a wrapper to guarantee the application is running solely within the domain group environment, this prevents any ambiguity between the web and acc environments (as the PHP versions and environment is identical when run in a wrapper)


n98-magerun is installed on a per domain-group/domain basis, you only need to install it once per Magento instance. Start by identifying your domain group name and domain name, in our example we'll use example and respectively. Once you know these, we can pass it to the installation script /microcloud/scripts_ro/

! The following should be run as the www-data user

[~]$ /microcloud/scripts_ro/ Usage: [domain-group] [domain]

  domain-group   Domain group (eg. example)
  domain         Domain name (eg.
  subdomain      Subdomain (eg. www|http)

So now its just a case of running the script with your options

[~]$ /microcloud/scripts_ro/ example http
Downloading MageRun ...
Success: MageRun is installed, use the command "mr_examplecom" to run - you must log out/in for this to be loaded

Once installed, you can either reload your bash profile for the new function to be available, or log out/in to your SSH session. You can reload your bash profile like this:

. ~/.bash_profile

Then you can access the tool using the new alias that has been created mr_examplecom

[~]$ mr_examplecom

     ___ ___
 _ _/ _ ( _ )___ _ __  __ _ __ _ ___ _ _ _  _ _ _
| ' \_, / _ \___| '  \/ _` / _` / -_) '_| || | ' \
|_||_/_/\___/   |_|_|_\__,_\__, \___|_|  \_,_|_||_|
n98-magerun version 1.90.0 by netz98 new media GmbH

  [options] command [arguments]

  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.
  --root-dir          Force magento root dir. No auto detection
  --skip-config       Do not load any custom config.

Available commands:
  help                             Displays help for a command
  install                          Install magento
  list                             Lists commands
  mysql-client                     Opens mysql client by database config from local.xml
  open-browser                     Open current project in browser (experimental)
  script                           Runs multiple n98-magerun commands
  self-update                      Updates n98-magerun.phar to the latest version.
  selfupdate                       Updates n98-magerun.phar to the latest version.
  shell                            Runs n98-magerun as shell
  uninstall                        Uninstall magento (drops database and empties current folder or folder set via installationFolder)
  admin:notifications              Toggles admin notifications
  admin:user:change-password       Changes the password of a adminhtml user.
  admin:user:create                Create admin user.
  admin:user:list                  List admin users.
  cache:clean                      Clean magento cache
  cache:disable                    Disables magento caches
  cache:enable                     Enables magento caches
  cache:flush                      Flush magento cache storage
  cache:list                       Lists all magento caches
  cache:report                     View inside the cache
  cache:view                       Prints a cache entry
  composer:diagnose                Diagnoses the system to identify common errors.
  composer:init                    Creates a basic composer.json file in current directory.
  composer:install                 Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
  composer:require                 Adds required packages to your composer.json and installs them
  composer:search                  Search for packages
  composer:update                  Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
  composer:validate                Validates a composer.json
  config:delete                    Deletes a store config item
  config:dump                      Dump merged xml config
  config:get                       Get a core config item
  config:search                    Search system configuration descriptions.
  config:set                       Set a core config item
  customer:change-password         Changes the password of a customer.
  customer:create                  Creates a new customer/user for shop frontend.
  customer:create:dummy            Generate dummy customers. You can specify a count and a locale.
  customer:info                    Loads basic customer info by email address.
  customer:list                    Lists customers
  db:console                       Opens mysql client by database config from local.xml
  db:create                        Create currently configured database
  db:drop                          Drop current database
  db:dump                          Dumps database with mysqldump cli client according to informations from local.xml
  db:import                        Imports database with mysql cli client according to database defined in local.xml
  db:info                          Dumps database informations
  db:maintain:check-tables         Check database tables
  db:query                         Executes an SQL query on the database defined in local.xml
  design:demo-notice               Toggles demo store notice for a store view
  dev:class:lookup                 Resolves a grouped class name
  dev:console                      Opens PHP interactive shell with initialized Mage::app() (Experimental)
  dev:ide:phpstorm:meta            Generates meta data file for PhpStorm auto completion
  dev:log                          Toggle development log (system.log, exception.log)
  dev:log:db                       Turn on/off database query logging
  dev:log:size                     Get size of log file
  dev:module:create                Create and register a new magento module.
  dev:module:dependencies:from     Show list of modules which depend on %s module
  dev:module:dependencies:on       Show list of modules which given module depends on
  dev:module:list                  List all installed modules
  dev:module:observer:list         Lists all registered observers
  dev:module:rewrite:conflicts     Lists all magento rewrite conflicts
  dev:module:rewrite:list          Lists all magento rewrites
  dev:profiler                     Toggles profiler for debugging
  dev:report:count                 Get count of report files
  dev:setup:script:attribute       Creates attribute script for a given attribute code
  dev:symlinks                     Toggle allow symlinks setting
  dev:template-hints               Toggles template hints
  dev:template-hints-blocks        Toggles template hints block names
  dev:theme:duplicates             Find duplicate files (templates, layout, locale, etc.) between two themes.
  dev:theme:list                   Lists all available themes
  dev:translate:admin              Toggle inline translation tool for admin
  dev:translate:export             Export inline translations
  dev:translate:set                Adds a translation to core_translate table. Globally for locale
  dev:translate:shop               Toggle inline translation tool for shop
  eav:attribute:list               Lists all EAV attributes
  eav:attribute:remove             Removes attribute for a given attribute code
  eav:attribute:view               View informations about an EAV attribute
  extension:download               Download magento-connect package
  extension:install                Install magento-connect package
  extension:list                   List magento connection extensions
  extension:search                 List magento connection extensions
  extension:upgrade                Upgrade magento-connect package
  extension:validate               Reads Magento Connect Config, and checks that installed package files are really there
  index:list                       Lists all magento indexes
  index:reindex                    Reindex a magento index by code
  index:reindex:all                Reindex all magento indexes
  local-config:generate            Generates local.xml config
  media:dump                       Creates an archive with content of media folder.
  script:repo:list                 Lists all scripts in repository
  script:repo:run                  Run script from repository
  sys:check                        Checks Magento System
  sys:cron:history                 Last executed cronjobs with status.
  sys:cron:list                    Lists all cronjobs
  sys:cron:run                     Runs a cronjob by job code
  sys:info                         Prints infos about the current magento system.
  sys:maintenance                  Toggles maintenance mode.
  sys:modules:list                 List all installed modules
  sys:setup:compare-versions       Compare module version with core_resource table.
  sys:setup:incremental            (Experimental) List new setup scripts to run, then runs one script
  sys:setup:run                    Runs all new setup scripts.
  sys:store:config:base-url:list   Lists all base urls
  sys:store:list                   Lists all installed store-views
  sys:url:list                     Get all urls.
  sys:website:list                 Lists all websites