drush
debug drush (and php-cli)
Drush uses the cli version of php so traditional debugging tools and functions don't work.
Aegir: perform custom tasks after a new site is installed
in a custom module, in a file called mysnippet.drush.inc (keep in mind that the install process is handled by drush...)