Git Product home page Git Product logo

magento-cron's Introduction

appserver.io Magento CRON Implementation

Build Status Scrutinizer Code Quality Code Coverage

This example describes how to execute Magento CRON jobs with a system CRON.

Why should/can i do this? When you run Magento on a Debian Linux for example, you've to register the cron.sh in your systems CRON table to be executed periodically. This is for sure NO big deal, but maybe come together with some handicaps like missing permissions to do this. If you run Magento inside appserver.io, life will a bit less complicated, because you're able to execute the Magento CRON by a Stateless session bean.

Installation

To do this, assumed you've installed appserver.io and your Magento instance will be delivered by appserver.io, you have two installation options.

For both options, you need the sources of this repository. So clone it, open a commandline, change into your working directory, which can be /tmp for example, and enter

$ git clone https://github.com/appserver-io-apps/magento-cron

Copy SLSB into your Magento installation

The first option is pretty simple. Copy the SFSB into your Magento application folder. Given, you've installed Magento in a folder /opt/appserver/webapps/magento-cron in the application servers document root, do the following:

$ cd /opt/appserver/webapps/magento-cron
$ mkdir META-INF/classes/AppserverIo/Apps/Magento/Cron/SessionBeans
$ cp /tmp/magento-cron/src/app/META-INF/classes/AppserverIo/Apps/Magento/Cron/SessionBeans/CronSessionBean.php \
     META-INF/classes/AppserverIo/Apps/Magento/Cron/SessionBeans

Then restart the application server, open http://127.0.0.1:9080/magento-cron/admin in your favorite browser, login to the Magento backend and clear the Magento cache. The Magento CRON jobs will now be invoked every minute.

Deploy the SLSB/Servlet together with a dummy extension

The second option is a bit more complicated, as it uses ANT to deploy the SLSB, a Servlet, that allows you to invoke the Magento CRON in your browser, and a dummy Magento extension, that will be invoked by the application servers Timer-Service the SLSB is bound to.

Change into the working copy with $ cd /tmp/magento-cron, then invoke ANT with ant deploy, restart the application server and finally clear the Magento cache. The Magento extension, the SLSB and the Servlet are now ready. The dummy extensions purpose is simple to log a message whenever the CRON invokes the method declared in the extensions config.xml.

You also have the possibility to invoke the CRON process manually. Simple use your favorite browser, request http://127.0.0.1:9080/magento-cron//invokeCron.do, and check the Magento system.log, assumed you've activated logging in Magento backend.

Summary

Keep in mind, that this is only a simple example and MUST* be tested before think of using in production!

magento-cron's People

Contributors

wagnert avatar wick-ed avatar zelgerj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.