Multisite drupal bootstrap
I ended up using this code:

chdir('/path/to/drupal/sites/example.com/');
define('DRUPAL_ROOT', '/path/to/drupal/core');
require_once('/path/to/drupal/includes/bootstrap.inc');
drupal_override_server_variables(array('url' =&gt; 'http://example.com/'));
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


It could perhaps be more efficient but it works from crontab.