magento 2 maintenance mode only frontend code example
Example: magento 2 enable maintenance mode
bin/magento maintenance:enable [--ip=<ip address> ... --ip=<ip address>] | [ip=none]
bin/magento maintenance:enable [--ip=<ip address> ... --ip=<ip address>] | [ip=none]