I'm currently facing a weird result with my script when running it by cron.
This script is creating the invoice and capture the amount online.

```
if($order->canInvoice()) {

  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
  $invoice->register()->pay(); 

  Mage::getModel('core/resource_transaction')
      ->addObject($invoice)
      ->addObject($invoice->getOrder())
      ->save();

  $invoice->sendEmail();

}

```

It works fine when I call the cron by Magento backend AEOScheduler, then "RunNow".

The problem is when the cron is executed automatically by crontab.
The invoice is created successfully but the event "sales\_order\_invoice\_pay" seems not fired. This is the event catched by my payment processor extension for capturing correctly the amount ONLINE.

Any idea/suggestion would be appreciate.
Thank you.