What do you do if you have to take your Drupal site into maintenance mode from the command line? Well you can do this easily if you have drush set up on your server. With drush you can do quite a lot powerful drupal administration tasks right from the command line.
In Drupal 6
The following drush command will take your Drupal site offline
drush vset site_offline 1
The following drush command will take your Drupal site back online
drush vdel site_offline
In Drupal 7