Magento2: CRON Job is scheduled but Not Running
I have created a Corn job followed this question Installed the Extension and
check the from admin back it says job are pending. below is the screenshot and my code in detail, Please let me if i am doing wrong anywhere.
All jobs are in pending state for very long time.
appcodeAutosynchsynchProductetccorntab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="custom_AutoSynch_cronjob" instance="AutosynchsynchProductPageService" method="execute">
<schedule>10 * * * *</schedule>
</job>
</group>
</config>
I need to run this below Code.
appcodeAutosynchsynchProductControllerPageService.php
<?php
namespace AutosynchsynchProductControllerPage;
use MagentoFrameworkHTTPClientCurl;
class Service extends MagentoFrameworkAppActionAction {
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkHTTPClientCurl $curl
*/
protected $_curl;
public function __construct(
MagentoFrameworkAppActionContext $context,
Curl $curl
)
{
parent::__construct($context);
$this->_curl =$curl;
}
/**
* Send SMS
* @param type $mobile_no
* @param type $body
*/
public function getMyCurlResponse($url)
{
//$url = urlencode($url);
$this->_curl->get($url);
$response = $this->_curl->getBody();
return $response;
}
public function myPostCallResponse(){
$ch = curl_init();
$url = "http://api.geonames.org/citiesJSON";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, "north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=jb1234");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$resultArray = json_decode($data)->geonames;
//print_r($data);
foreach ($resultArray as $key => $value) {
# code...
echo " City : ".$value->toponymName.", n";
}
die();
}
public function execute()
{
//$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$result = $this->getMyCurlResponse($priceCheck);
$resArray = json_decode($result)->result;
foreach ($resArray as $key => $value) {
# code...
//echo " SKU: ",$value->sku,", name: ",$value->name,", Price: ",$value->price, ", Qty: ",$value->qty,". n";
$product_id = $value->sku;
$price = $value->price;
$qty = $value->qty;
echo " nn in check for update Method SKU: ", $product_id,", Price: ", $price, ", Qty: ",$qty;
$this->updateProduct($product_id, $price, $qty);
}
}
public function updateProduct($product_id, $price, $qty1){
// echo "in Update Product",$product_id,", price : ",$price, ", Qty : ",$qty1,"";
ini_set('max_execution_time', 0);
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$storeId = '1'; //Store ID
//$product = $objectManager->get('catalog/product');
$productFactory = $objectManager->get('MagentoCatalogModelProductFactory');
//$product = $productFactory->create()->setStoreId($storeId)->load($product_id);
$product = $productFactory->create();
$prduct_id_sku = $product->load($product->getIdBySku($product_id));
//echo "in Update Product method : ", pro;
$oldprice = $product->getPrice();
$productName = $product->getName();
// echo "Product Name:", $productName, ",n Product ID:",$product->getId(),", SKU: ",$prduct_id_sku->getSku()," ";
// echo ",n product Quantity: ",$prduct_id_sku->getStockItem();
// $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
// echo $stock->getQty();
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$oldstock = $StockState->getStockQty($product->getId());
//echo $StockState->getStockQty($product->getId());//, $product->getStore()->getWebsiteId());
//echo $StockState->getStockQty(1);
//$StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId())
//$product->getStore()->getWebsiteId()->suggestQty("101");
//$Product->
//$StockState->save();
// echo " n Current price is : ", $oldprice;
if ((($oldprice != $price) || $oldstock != $qty1 ) && $oldstock) {
$product->setPrice($price);
// echo ",n new price Updated ",$price;
if ($oldstock != $qty1) {
$product->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => $qty1 ));
//$product->setStockData(['qty' => $qty1, 'is_in_stock' => 1]);
$product->setQuantityAndStockStatus(['qty' => $qty1, 'is_in_stock' => 1]);
// echo " n Updated Stock:";
// print_r($product->getStockData()['qty']);
}else{
//echo " n oldStock & new stock are equal ".$qty;
}
$product->save();
}else {
//echo " n oldprice & new price are equal ".$price;
}
unset($storeIds, $websiteObj, $_websiteId);
unset($product);
}
}
magento2 controllers cron
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have created a Corn job followed this question Installed the Extension and
check the from admin back it says job are pending. below is the screenshot and my code in detail, Please let me if i am doing wrong anywhere.
All jobs are in pending state for very long time.
appcodeAutosynchsynchProductetccorntab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="custom_AutoSynch_cronjob" instance="AutosynchsynchProductPageService" method="execute">
<schedule>10 * * * *</schedule>
</job>
</group>
</config>
I need to run this below Code.
appcodeAutosynchsynchProductControllerPageService.php
<?php
namespace AutosynchsynchProductControllerPage;
use MagentoFrameworkHTTPClientCurl;
class Service extends MagentoFrameworkAppActionAction {
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkHTTPClientCurl $curl
*/
protected $_curl;
public function __construct(
MagentoFrameworkAppActionContext $context,
Curl $curl
)
{
parent::__construct($context);
$this->_curl =$curl;
}
/**
* Send SMS
* @param type $mobile_no
* @param type $body
*/
public function getMyCurlResponse($url)
{
//$url = urlencode($url);
$this->_curl->get($url);
$response = $this->_curl->getBody();
return $response;
}
public function myPostCallResponse(){
$ch = curl_init();
$url = "http://api.geonames.org/citiesJSON";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, "north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=jb1234");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$resultArray = json_decode($data)->geonames;
//print_r($data);
foreach ($resultArray as $key => $value) {
# code...
echo " City : ".$value->toponymName.", n";
}
die();
}
public function execute()
{
//$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$result = $this->getMyCurlResponse($priceCheck);
$resArray = json_decode($result)->result;
foreach ($resArray as $key => $value) {
# code...
//echo " SKU: ",$value->sku,", name: ",$value->name,", Price: ",$value->price, ", Qty: ",$value->qty,". n";
$product_id = $value->sku;
$price = $value->price;
$qty = $value->qty;
echo " nn in check for update Method SKU: ", $product_id,", Price: ", $price, ", Qty: ",$qty;
$this->updateProduct($product_id, $price, $qty);
}
}
public function updateProduct($product_id, $price, $qty1){
// echo "in Update Product",$product_id,", price : ",$price, ", Qty : ",$qty1,"";
ini_set('max_execution_time', 0);
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$storeId = '1'; //Store ID
//$product = $objectManager->get('catalog/product');
$productFactory = $objectManager->get('MagentoCatalogModelProductFactory');
//$product = $productFactory->create()->setStoreId($storeId)->load($product_id);
$product = $productFactory->create();
$prduct_id_sku = $product->load($product->getIdBySku($product_id));
//echo "in Update Product method : ", pro;
$oldprice = $product->getPrice();
$productName = $product->getName();
// echo "Product Name:", $productName, ",n Product ID:",$product->getId(),", SKU: ",$prduct_id_sku->getSku()," ";
// echo ",n product Quantity: ",$prduct_id_sku->getStockItem();
// $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
// echo $stock->getQty();
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$oldstock = $StockState->getStockQty($product->getId());
//echo $StockState->getStockQty($product->getId());//, $product->getStore()->getWebsiteId());
//echo $StockState->getStockQty(1);
//$StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId())
//$product->getStore()->getWebsiteId()->suggestQty("101");
//$Product->
//$StockState->save();
// echo " n Current price is : ", $oldprice;
if ((($oldprice != $price) || $oldstock != $qty1 ) && $oldstock) {
$product->setPrice($price);
// echo ",n new price Updated ",$price;
if ($oldstock != $qty1) {
$product->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => $qty1 ));
//$product->setStockData(['qty' => $qty1, 'is_in_stock' => 1]);
$product->setQuantityAndStockStatus(['qty' => $qty1, 'is_in_stock' => 1]);
// echo " n Updated Stock:";
// print_r($product->getStockData()['qty']);
}else{
//echo " n oldStock & new stock are equal ".$qty;
}
$product->save();
}else {
//echo " n oldprice & new price are equal ".$price;
}
unset($storeIds, $websiteObj, $_websiteId);
unset($product);
}
}
magento2 controllers cron
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
have you configured cron on server?
– kunj
Jun 4 '18 at 6:19
I don't know this step, Can u Please guide me. @kunj
– JB Pakalapati
Jun 4 '18 at 6:20
I have added answer.
– kunj
Jun 4 '18 at 6:23
add a comment |
I have created a Corn job followed this question Installed the Extension and
check the from admin back it says job are pending. below is the screenshot and my code in detail, Please let me if i am doing wrong anywhere.
All jobs are in pending state for very long time.
appcodeAutosynchsynchProductetccorntab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="custom_AutoSynch_cronjob" instance="AutosynchsynchProductPageService" method="execute">
<schedule>10 * * * *</schedule>
</job>
</group>
</config>
I need to run this below Code.
appcodeAutosynchsynchProductControllerPageService.php
<?php
namespace AutosynchsynchProductControllerPage;
use MagentoFrameworkHTTPClientCurl;
class Service extends MagentoFrameworkAppActionAction {
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkHTTPClientCurl $curl
*/
protected $_curl;
public function __construct(
MagentoFrameworkAppActionContext $context,
Curl $curl
)
{
parent::__construct($context);
$this->_curl =$curl;
}
/**
* Send SMS
* @param type $mobile_no
* @param type $body
*/
public function getMyCurlResponse($url)
{
//$url = urlencode($url);
$this->_curl->get($url);
$response = $this->_curl->getBody();
return $response;
}
public function myPostCallResponse(){
$ch = curl_init();
$url = "http://api.geonames.org/citiesJSON";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, "north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=jb1234");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$resultArray = json_decode($data)->geonames;
//print_r($data);
foreach ($resultArray as $key => $value) {
# code...
echo " City : ".$value->toponymName.", n";
}
die();
}
public function execute()
{
//$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$result = $this->getMyCurlResponse($priceCheck);
$resArray = json_decode($result)->result;
foreach ($resArray as $key => $value) {
# code...
//echo " SKU: ",$value->sku,", name: ",$value->name,", Price: ",$value->price, ", Qty: ",$value->qty,". n";
$product_id = $value->sku;
$price = $value->price;
$qty = $value->qty;
echo " nn in check for update Method SKU: ", $product_id,", Price: ", $price, ", Qty: ",$qty;
$this->updateProduct($product_id, $price, $qty);
}
}
public function updateProduct($product_id, $price, $qty1){
// echo "in Update Product",$product_id,", price : ",$price, ", Qty : ",$qty1,"";
ini_set('max_execution_time', 0);
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$storeId = '1'; //Store ID
//$product = $objectManager->get('catalog/product');
$productFactory = $objectManager->get('MagentoCatalogModelProductFactory');
//$product = $productFactory->create()->setStoreId($storeId)->load($product_id);
$product = $productFactory->create();
$prduct_id_sku = $product->load($product->getIdBySku($product_id));
//echo "in Update Product method : ", pro;
$oldprice = $product->getPrice();
$productName = $product->getName();
// echo "Product Name:", $productName, ",n Product ID:",$product->getId(),", SKU: ",$prduct_id_sku->getSku()," ";
// echo ",n product Quantity: ",$prduct_id_sku->getStockItem();
// $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
// echo $stock->getQty();
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$oldstock = $StockState->getStockQty($product->getId());
//echo $StockState->getStockQty($product->getId());//, $product->getStore()->getWebsiteId());
//echo $StockState->getStockQty(1);
//$StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId())
//$product->getStore()->getWebsiteId()->suggestQty("101");
//$Product->
//$StockState->save();
// echo " n Current price is : ", $oldprice;
if ((($oldprice != $price) || $oldstock != $qty1 ) && $oldstock) {
$product->setPrice($price);
// echo ",n new price Updated ",$price;
if ($oldstock != $qty1) {
$product->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => $qty1 ));
//$product->setStockData(['qty' => $qty1, 'is_in_stock' => 1]);
$product->setQuantityAndStockStatus(['qty' => $qty1, 'is_in_stock' => 1]);
// echo " n Updated Stock:";
// print_r($product->getStockData()['qty']);
}else{
//echo " n oldStock & new stock are equal ".$qty;
}
$product->save();
}else {
//echo " n oldprice & new price are equal ".$price;
}
unset($storeIds, $websiteObj, $_websiteId);
unset($product);
}
}
magento2 controllers cron
I have created a Corn job followed this question Installed the Extension and
check the from admin back it says job are pending. below is the screenshot and my code in detail, Please let me if i am doing wrong anywhere.
All jobs are in pending state for very long time.
appcodeAutosynchsynchProductetccorntab.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="custom_AutoSynch_cronjob" instance="AutosynchsynchProductPageService" method="execute">
<schedule>10 * * * *</schedule>
</job>
</group>
</config>
I need to run this below Code.
appcodeAutosynchsynchProductControllerPageService.php
<?php
namespace AutosynchsynchProductControllerPage;
use MagentoFrameworkHTTPClientCurl;
class Service extends MagentoFrameworkAppActionAction {
/**
* @param MagentoFrameworkAppActionContext $context
* @param MagentoFrameworkHTTPClientCurl $curl
*/
protected $_curl;
public function __construct(
MagentoFrameworkAppActionContext $context,
Curl $curl
)
{
parent::__construct($context);
$this->_curl =$curl;
}
/**
* Send SMS
* @param type $mobile_no
* @param type $body
*/
public function getMyCurlResponse($url)
{
//$url = urlencode($url);
$this->_curl->get($url);
$response = $this->_curl->getBody();
return $response;
}
public function myPostCallResponse(){
$ch = curl_init();
$url = "http://api.geonames.org/citiesJSON";
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, "north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=jb1234");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$resultArray = json_decode($data)->geonames;
//print_r($data);
foreach ($resultArray as $key => $value) {
# code...
echo " City : ".$value->toponymName.", n";
}
die();
}
public function execute()
{
//$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$priceCheck = 'http://alaincopheadofficen-2.fortiddns.com:555/webservices/getupdates.php';
$result = $this->getMyCurlResponse($priceCheck);
$resArray = json_decode($result)->result;
foreach ($resArray as $key => $value) {
# code...
//echo " SKU: ",$value->sku,", name: ",$value->name,", Price: ",$value->price, ", Qty: ",$value->qty,". n";
$product_id = $value->sku;
$price = $value->price;
$qty = $value->qty;
echo " nn in check for update Method SKU: ", $product_id,", Price: ", $price, ", Qty: ",$qty;
$this->updateProduct($product_id, $price, $qty);
}
}
public function updateProduct($product_id, $price, $qty1){
// echo "in Update Product",$product_id,", price : ",$price, ", Qty : ",$qty1,"";
ini_set('max_execution_time', 0);
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$storeId = '1'; //Store ID
//$product = $objectManager->get('catalog/product');
$productFactory = $objectManager->get('MagentoCatalogModelProductFactory');
//$product = $productFactory->create()->setStoreId($storeId)->load($product_id);
$product = $productFactory->create();
$prduct_id_sku = $product->load($product->getIdBySku($product_id));
//echo "in Update Product method : ", pro;
$oldprice = $product->getPrice();
$productName = $product->getName();
// echo "Product Name:", $productName, ",n Product ID:",$product->getId(),", SKU: ",$prduct_id_sku->getSku()," ";
// echo ",n product Quantity: ",$prduct_id_sku->getStockItem();
// $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
// echo $stock->getQty();
$StockState = $objectManager->get('MagentoCatalogInventoryApiStockStateInterface');
$oldstock = $StockState->getStockQty($product->getId());
//echo $StockState->getStockQty($product->getId());//, $product->getStore()->getWebsiteId());
//echo $StockState->getStockQty(1);
//$StockState->getStockQty($product->getId(), $product->getStore()->getWebsiteId())
//$product->getStore()->getWebsiteId()->suggestQty("101");
//$Product->
//$StockState->save();
// echo " n Current price is : ", $oldprice;
if ((($oldprice != $price) || $oldstock != $qty1 ) && $oldstock) {
$product->setPrice($price);
// echo ",n new price Updated ",$price;
if ($oldstock != $qty1) {
$product->setStockData(array(
'use_config_manage_stock' => 0,
'manage_stock' => 1,
'is_in_stock' => 1,
'qty' => $qty1 ));
//$product->setStockData(['qty' => $qty1, 'is_in_stock' => 1]);
$product->setQuantityAndStockStatus(['qty' => $qty1, 'is_in_stock' => 1]);
// echo " n Updated Stock:";
// print_r($product->getStockData()['qty']);
}else{
//echo " n oldStock & new stock are equal ".$qty;
}
$product->save();
}else {
//echo " n oldprice & new price are equal ".$price;
}
unset($storeIds, $websiteObj, $_websiteId);
unset($product);
}
}
magento2 controllers cron
magento2 controllers cron
asked Jun 4 '18 at 6:18
JB PakalapatiJB Pakalapati
475216
475216
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
have you configured cron on server?
– kunj
Jun 4 '18 at 6:19
I don't know this step, Can u Please guide me. @kunj
– JB Pakalapati
Jun 4 '18 at 6:20
I have added answer.
– kunj
Jun 4 '18 at 6:23
add a comment |
have you configured cron on server?
– kunj
Jun 4 '18 at 6:19
I don't know this step, Can u Please guide me. @kunj
– JB Pakalapati
Jun 4 '18 at 6:20
I have added answer.
– kunj
Jun 4 '18 at 6:23
have you configured cron on server?
– kunj
Jun 4 '18 at 6:19
have you configured cron on server?
– kunj
Jun 4 '18 at 6:19
I don't know this step, Can u Please guide me. @kunj
– JB Pakalapati
Jun 4 '18 at 6:20
I don't know this step, Can u Please guide me. @kunj
– JB Pakalapati
Jun 4 '18 at 6:20
I have added answer.
– kunj
Jun 4 '18 at 6:23
I have added answer.
– kunj
Jun 4 '18 at 6:23
add a comment |
2 Answers
2
active
oldest
votes
Try this :
You can run CRON by this command: php bin/magento cron:run
by terminal or cmd. Even you can configure CRON in server by ssh using crontab -e
command. Maybe you will need root user of server you can learn about Magento 2 CRON configuration from here : Magento 2 cron.
You can check CRON successful run or not from cron_schedule
database table. You can check CRON status by this command on the server : sudo service cron status
.
I used this command thenphp bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.
– JB Pakalapati
Jun 4 '18 at 6:26
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
Even you get out put like error byphp bin/magento cron:run
this command
– kunj
Jun 4 '18 at 6:28
I got this Result when i used thatcorn:run
command :C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
you have to enable or installphp_interbase.dll
.
– kunj
Jun 4 '18 at 7:52
|
show 3 more comments
Create the cron job
To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:
crontab -u <Magento file system owner user name> -e
For example,
crontab -u magento_user -e
A text editor displays. (You might need to choose a text editor first.)
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log
where
<path to php binary>
is the absolute file system path to your PHP binary
<magento install dir>
is the directory in which you installed the Magento software; for example, /var/www
| grep -v "Ran jobs by schedule"
Reference
I tried this is the result i got :C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f228480%2fmagento2-cron-job-is-scheduled-but-not-running%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this :
You can run CRON by this command: php bin/magento cron:run
by terminal or cmd. Even you can configure CRON in server by ssh using crontab -e
command. Maybe you will need root user of server you can learn about Magento 2 CRON configuration from here : Magento 2 cron.
You can check CRON successful run or not from cron_schedule
database table. You can check CRON status by this command on the server : sudo service cron status
.
I used this command thenphp bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.
– JB Pakalapati
Jun 4 '18 at 6:26
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
Even you get out put like error byphp bin/magento cron:run
this command
– kunj
Jun 4 '18 at 6:28
I got this Result when i used thatcorn:run
command :C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
you have to enable or installphp_interbase.dll
.
– kunj
Jun 4 '18 at 7:52
|
show 3 more comments
Try this :
You can run CRON by this command: php bin/magento cron:run
by terminal or cmd. Even you can configure CRON in server by ssh using crontab -e
command. Maybe you will need root user of server you can learn about Magento 2 CRON configuration from here : Magento 2 cron.
You can check CRON successful run or not from cron_schedule
database table. You can check CRON status by this command on the server : sudo service cron status
.
I used this command thenphp bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.
– JB Pakalapati
Jun 4 '18 at 6:26
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
Even you get out put like error byphp bin/magento cron:run
this command
– kunj
Jun 4 '18 at 6:28
I got this Result when i used thatcorn:run
command :C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
you have to enable or installphp_interbase.dll
.
– kunj
Jun 4 '18 at 7:52
|
show 3 more comments
Try this :
You can run CRON by this command: php bin/magento cron:run
by terminal or cmd. Even you can configure CRON in server by ssh using crontab -e
command. Maybe you will need root user of server you can learn about Magento 2 CRON configuration from here : Magento 2 cron.
You can check CRON successful run or not from cron_schedule
database table. You can check CRON status by this command on the server : sudo service cron status
.
Try this :
You can run CRON by this command: php bin/magento cron:run
by terminal or cmd. Even you can configure CRON in server by ssh using crontab -e
command. Maybe you will need root user of server you can learn about Magento 2 CRON configuration from here : Magento 2 cron.
You can check CRON successful run or not from cron_schedule
database table. You can check CRON status by this command on the server : sudo service cron status
.
answered Jun 4 '18 at 6:22
kunjkunj
2,6502423
2,6502423
I used this command thenphp bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.
– JB Pakalapati
Jun 4 '18 at 6:26
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
Even you get out put like error byphp bin/magento cron:run
this command
– kunj
Jun 4 '18 at 6:28
I got this Result when i used thatcorn:run
command :C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
you have to enable or installphp_interbase.dll
.
– kunj
Jun 4 '18 at 7:52
|
show 3 more comments
I used this command thenphp bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.
– JB Pakalapati
Jun 4 '18 at 6:26
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
Even you get out put like error byphp bin/magento cron:run
this command
– kunj
Jun 4 '18 at 6:28
I got this Result when i used thatcorn:run
command :C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
you have to enable or installphp_interbase.dll
.
– kunj
Jun 4 '18 at 7:52
I used this command then
php bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.– JB Pakalapati
Jun 4 '18 at 6:26
I used this command then
php bin/magento cron:run
I got result as shown in screenshot in question, it creates now corn jobs but these are in pending state for very long time. what should i do now.– JB Pakalapati
Jun 4 '18 at 6:26
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
first time it will create cron schedule second time while you run this command it will run your schedule crons.
– kunj
Jun 4 '18 at 6:28
Even you get out put like error by
php bin/magento cron:run
this command– kunj
Jun 4 '18 at 6:28
Even you get out put like error by
php bin/magento cron:run
this command– kunj
Jun 4 '18 at 6:28
I got this Result when i used that
corn:run
command : C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
I got this Result when i used that
corn:run
command : C:xampphtdocsMagento-CE>php bin/magento cron:run Failed loading c:xamppphpextxdebug.dll PHP Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'C:xamppphpextphp_interbase.dll' - The specified module could not be found. in Unknown on line 0 Ran jobs by schedule.
– JB Pakalapati
Jun 4 '18 at 6:31
you have to enable or install
php_interbase.dll
.– kunj
Jun 4 '18 at 7:52
you have to enable or install
php_interbase.dll
.– kunj
Jun 4 '18 at 7:52
|
show 3 more comments
Create the cron job
To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:
crontab -u <Magento file system owner user name> -e
For example,
crontab -u magento_user -e
A text editor displays. (You might need to choose a text editor first.)
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log
where
<path to php binary>
is the absolute file system path to your PHP binary
<magento install dir>
is the directory in which you installed the Magento software; for example, /var/www
| grep -v "Ran jobs by schedule"
Reference
I tried this is the result i got :C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
add a comment |
Create the cron job
To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:
crontab -u <Magento file system owner user name> -e
For example,
crontab -u magento_user -e
A text editor displays. (You might need to choose a text editor first.)
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log
where
<path to php binary>
is the absolute file system path to your PHP binary
<magento install dir>
is the directory in which you installed the Magento software; for example, /var/www
| grep -v "Ran jobs by schedule"
Reference
I tried this is the result i got :C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
add a comment |
Create the cron job
To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:
crontab -u <Magento file system owner user name> -e
For example,
crontab -u magento_user -e
A text editor displays. (You might need to choose a text editor first.)
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log
where
<path to php binary>
is the absolute file system path to your PHP binary
<magento install dir>
is the directory in which you installed the Magento software; for example, /var/www
| grep -v "Ran jobs by schedule"
Reference
Create the cron job
To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:
crontab -u <Magento file system owner user name> -e
For example,
crontab -u magento_user -e
A text editor displays. (You might need to choose a text editor first.)
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log
where
<path to php binary>
is the absolute file system path to your PHP binary
<magento install dir>
is the directory in which you installed the Magento software; for example, /var/www
| grep -v "Ran jobs by schedule"
Reference
answered Jun 4 '18 at 6:26
Nikunj VadariyaNikunj Vadariya
2,8701821
2,8701821
I tried this is the result i got :C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
add a comment |
I tried this is the result i got :C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
I tried this is the result i got :
C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
I tried this is the result i got :
C:xampphtdocsMagento-CE>crontab -u superadmin -e 'crontab' is not recognized as an internal or external command, operable program or batch file.
– JB Pakalapati
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
crontab is not for windows OS
– kunj
Jun 4 '18 at 6:29
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
So, you have to run cron by command.
– kunj
Jun 4 '18 at 6:30
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f228480%2fmagento2-cron-job-is-scheduled-but-not-running%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have you configured cron on server?
– kunj
Jun 4 '18 at 6:19
I don't know this step, Can u Please guide me. @kunj
– JB Pakalapati
Jun 4 '18 at 6:20
I have added answer.
– kunj
Jun 4 '18 at 6:23