groovy maintenance

How to manage locked nodes when running Groovy scripts?

Question

How to manage locked nodes when running Groovy scripts?

Answer

To run scripts in Read-only mode and in Maintenance to block any request to edit/contribute/studio/administration modes.
This mode can be dynamically enabled via http://localhost:8080/modules/tools/maintenance.jsp