0

I need to refresh a link every 5 minutes, how to schedule cron for refreshing the url

1

Tow way to set cron :

1) cpanel cron set

GoTo Cpanel->corn job setting -> set file path.

2) Using magento . you have to create module .

app/etc/modules/Compnyname_ModuleName.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Compnyname_ModuleName>
      <active>true</active>
      <codePool>local</codePool>
      <version>0.1.0</version>
    </Compnyname_ModuleName>
  </modules>
</config>

app/code/local/Compnyname/ModuleName/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Compnyname_ModuleName>
      <version>0.1.0</version>
    </Compnyname_ModuleName>
  </modules>
  <global>
    <helpers>
      <modulename>
        <class>Compnyname_ModuleName_Helper</class>
      </modulename>
    </helpers>
    <models>
      <modulename>
        <class>Compnyname_ModuleName_Model</class>
        <resourceModel>modulename_mysql4</resourceModel>
      </modulename>
    </models>
  </global>    
    <crontab>
        <jobs>            
            <modulename_cornmethodname>
                <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
                <run><model>modulename/cron::cornmethodname</model></run>
            </modulename_cornmethodname>
        </jobs>
    </crontab>
</config> 

<cron_expr>set time setting as you want</cron_expr>

app/code/local/Compnyname/ModuleName/Helper/Data.php

<?php
class Compnyname_ModuleName_Helper_Data extends Mage_Core_Helper_Abstract
{
}

app/code/local/Compnyname/ModuleName/Model/Cron.php

<?php
class Compnyname_ModuleName_Model_Cron{ 
    public function cornmethodname(){
        //do something
    } 
}

Set your cron code in Cron.php.

0

you just point it to your file or page:

*/5 * * * *  curl --silent "http://example.come/some/page" >/dev/null 2>&1
  • "-":4: bad command errors in crontab file, can't install. it shows this error – vellai durai Mar 22 '16 at 15:22
  • you can try without --silent – MagenX Mar 23 '16 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.