Since working with Magento 2 keeps coming back in places, that you have already had, I just want everyday SSH in this post- / CLI – Collect commands and post a brief description of each. I will add a new command every now and then, change or delete one, depending on.
The order came about by chance:
Deactivate or deactivate Debug.log. activate
In the standard, Magento generates 2 a file, which stores a lot of information from ongoing operations, so that developers always have the opportunity to find troubleshooting tips there. It has to be mentioned, however, that in debug.log -in contrast to exception.log and system.log- In addition to errors, correct processes are also saved. This leads to, that the file grows very quickly and thus takes up LOTS of storage space.
As soon as you have completed the development phase or currently have no use for this information, one should deactivate the debug.log. This happens - like so much with M2- by a command via SSH:
bin/magento setup:config:set --enable-debug-logging=false
If you want to activate the logging again later, this happens through:
bin/magento setup:config:set --enable-debug-logging=true
It can't hurt to clear the cache afterwards:
bin/magento cache:flush
Put Magento into live mode after development
Magento 2 has three different modes: development, default, production. With the following command you can see which mode the system is currently in:
bin/magento deploy:mode:show
To now in the Live- / Switch to production mode, it is best to use the following command
bin/magento deploy:mode:set production
Magento will then switch to maintenance mode and (in a nutshell) do anything, what is necessary, to switch to live mode. This sometimes takes a few minutes and then it becomes (normally) the maintenance mode is also automatically deactivated again and ….. one is live!
And then switch to development mode again
For the sake of completeness, here are the commands for the development mode and everything around it:
First you have to delete the contents of two directories:
rm -rf <magento_root>/generated/metadata/* <magento_root>/generated/code/*
Then change the mode:
bin/magento deploy:mode:set developer
Magento 2 Clear cache via SSH
Only a moment – even if I already mentioned it above:
php bin/magento cache:clean
And the index at Magento 2 delete
That too:
php bin/magento indexer:reindex
Magento 2 Create cron jobs via SSH
Magento 2 In contrast to M1, it needs a functioning cron job, to run smoothly. This can be easily created in the standard version by command:
bin/magento cron:install