Enable or disable maintenance mode
Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.
If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:
su <Magento file system owner> -s /bin/bash -c <command>
If the Magento file system owner does not allow logins you can do the following:
sudo -u <Magento file system owner> <command>
To run Magento commands from any directory, add
<your Magento install dir>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
You can also run the commands in the following ways:
cd <your Magento install dir>/binand run them as
./magento <command name>
php <your Magento install dir>/bin/magento <command name>
<your Magento install dir>is a subdirectory of your web server’s docroot. Need help locating the docroot?
In addition to the command arguments discussed here, see Common arguments.
Before you use this command, you must install the Magento software.
Enable or disable maintenance mode
Magento uses maintenance mode to disable bootstrapping; for example, while you’re maintaining, upgrading, or reconfiguring your site.
Magento detects maintenance mode as follows:
var/.maintenance.flagdoes not exist, maintenance mode is off and Magento operates normally.
Otherwise, maintenance mode is on unless
var/.maintenance.ipcan contain a list of IP addresses. If an entry point is accessed using HTTP and the client IP address corresponds to one of the entries in that list, then maintenance mode is off.
magento maintenance:enable [--ip=<ip address> ... --ip=<ip address>] | [ip=none] magento maintenance:disable [--ip=<ip address> ... --ip=<ip address>] | [ip=none] magento maintenance:status
--ip=<ip address> is an IP address to exempt from maintenance mode (for example, developers doing the maintenance). To exempt more than one IP address in the same command, use the option multiple times.
magento maintenance:disablemeans only that you’re saving the list of IPs for later use.
- To clear the list of exempt IPs, you can use
magento maintenance:enable --ip=noneor see Maintain the list of exempt IP addresses.
magento maintenance:status displays the current status of maintenance mode.
For example, to enable maintenance mode with no IP address exemptions:
To enable maintenance mode for all clients except 192.0.2.10 and 192.0.2.11:
magento maintenance:enable --ip=192.0.2.10 --ip=192.0.2.11
Maintain the list of exempt IP addresses
To maintain the list of exempt IP addresses, you can either use the
[--ip=<ip list>] option in the preceding commands or you can use the following:
magento maintenance:allow-ips <ip address> .. <ip address> [--none]
<ip address> .. <ip address> is an optional space-delimited list of IP addresses to exempt.
--none clears the list.
- Installing the Magento software using the command line
- Remove sample data modules or update sample data
- Enable or disable modules
- Display or change the Admin URI
- Uninstall modules
- Create or update the deployment configuration
- Create the Magento database schema
- Update the Magento database schema and data
- Configure the store
- Create or unlock a Magento administrator
- Back up and roll back the file system, media, and database
- Uninstall themes
- Uninstall language packages
- Uninstall the Magento software
- Update the Magento software
- Reinstall the Magento software