How do I configure multiple environments for console commands?
Alternatively, you could write your own yiic shell wrapper for each environment that defined CRAFT_ENVIRONMENT.

Something like yiicstaging:

#!/usr/bin/env php
&lt;?php

define('CRAFT_ENVIRONMENT', 'staging')
require_once('path/to/craft/app/etc/console/yiic.php');