Is there a way to put CiviCRM in read-only mode or deactivate forms programmatically?
For the CiviContribute forms, you can choose Disable for each form from the Manage Contribution Pages screen (civicrm/admin/contribute?reset=1 on 4.6 LTS).  The Disable option is under the More link. When maintenance is done, you can Enable each one in the same way.

For something from the command line:

There is an entity in the API called ContributionPage with a parameter called "Is Page Active?" (is_active). I just executed the Create action thru the API Explorer and it seems to have worked. I would test it out and see what works best for you. The API Explorer lists the drush command as: drush cvapi ContributionPage.create sequential=1 id=15 is_active=0 (0 being disabled and 1 being enabled)