Magento 2 || Shell script - mpaz-redstage/magento-snippets GitHub Wiki
php -f test.php
<?php
use Magento\Framework\App\Bootstrap;
ini_set('display_errors', true);
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode(\Magento\Framework\App\Area::AREA_GLOBAL);
/**Example: Test a cron*/
$cronObject = $objectManager->create('Redstage\Booking\Cron\Mail');
$cronObject->execute();
/**Example: Test a cron*/