Contents

    Setting up the task scheduler for exports

    Your task/initial situation

    You have configured one or more exports, for example for a price search engine, and would like to have regular exports carried out.

    Automating exports

    1. Open the task scheduler in the back end of JTL-Shop via Administration > Export > Export manager.
    1. Then click Create new task. The page Export formats opens.
    2. Use the Export formats drop-down menu to select the format to be created.
    3. Then, under Start date, set the time when the first export should take place and under Every X hours, specify how often the export should be repeated. The start date must have the following format: dd.mm.yyyy hh:mm.
    1. Click Create new task. You are forwarded to the page Export manager page. Your newly created schedule is listed there.

    Starting exports

    Automatically

    The task scheduler can also be run automatically. With the NOVA template, this is possible via Cron taks; with the EVO template, a blind graphic is also available.

    • Cron task: Please follow the instructions for triggering the Export manager via Cron tasks below.
    • Blind graphic (EVO only): The task scheduler is triggered via a so-called blind graphic, i.e. a graphic that cannot be seen by your customers. Each time the blind graphic is loaded, the task scheduler checks whether the required time period until the next export has already been exceeded and, if necessary, carries out the export. In the template, activate the option Aufgabenplaner-Blindgrafik aktivieren? (Activate task scheduler blind graphic?); see EVO template.

    Manually

    You can also trigger the export manually, regardless of whether the specified time window has already elapsed.

    1. Open the page Export manager in the back end of JTL-Shop via Administration > Export > Export manager.
    2. Click on the Trigger Cron manually button. The export is now carried out and the interval is reset.
    Please note: In our JTL-Shop FAQs, you will find more information on irregular processing.

    Frequently asked questions

    How and when are tasks processed in the task scheduler?

    The tasks stored in the back end under Administration > Export > Export manager are processed in JTL-Shop as follows:

    By default, the online shop tries to start the task schedule with every tenth time a page is opened. To do this, the server starts a server-to-server request (curl), which calls up the URL <ShopURL>/includes/Cron_inc.php. This starts the task scheduler. It processes parts of the tasks in the queue. The next time the task scheduler is called up, the next part of the tasks is processed. Thanks to this method, no further Cron tasks are necessary for an online shop with regular visitors. The tasks are triggered one after the other by page views.
    Calling up the server-to-server request or triggering the task scheduler does not affect the loading time of the page.

    By calling up the URL <ShopURL>/includes/Cron_inc.php, the processing of the tasks can be triggered manually. If no content is displayed on the page, either there are currently no tasks in the queue or a task process is currently being processed.

    However, we strongly recommend installing a proper Cron task that is not dependent on regular page views but calls <shoproot>/includes/Cron_inc.php itself at fixed intervals.

    Why are my planned tasks not being completed or completed only irregularly?

    The task scheduler is not a real Cron task. This means that the tasks are not triggered at a fixed interval but are started by the page views in relation to the call-up time. This means that if a page is called up and the call-up time (per time stamp) is divisible by 10 without remainder (modulo 10), the task is started. On average, the task is triggered approximately every 10 page views and, under optimal conditions, also approximately at the interval specified by the “Every X hours” option. Due to low visitor numbers, tasks may be delayed or, in the case of very low visitor numbers, may even not be carried out at all for a time.

    Newsletters and exports are both carried out automatically via the task scheduler. If the number of visitors to your JTL-Shop is low, the start of the task may be delayed, which leads to the newsletters or exports being sent late or even not sent at all.

    Triggering the task scheduler via Cron tasks

    If you can create your own Cron tasks (either Cron tasks on your own server or through external Cron calls), please follow the instructions below:

    You can trigger the PHP script directly via Cron call.

    Caution: Do not set higher values than the following standard values: M_EXPORTe=1000; Jobqueue = 5. Otherwise there might be export problems. Only with JTL-Shop 5, crashed scheduled tasks are automatically reset after 1–2 hours and then exported.

    If the Cron service runs on the same server as the shop, then the script is called up as follows (adapt the path to the online shop!):

    php /pfadZumShop/includes/cron_inc.php
    Example of application: Write the following in the file includes/config.JTL-Shop.ini.php:
    define('JOBQUEUE_LIMIT_M_EXPORTE', 250);
    define('JOBQUEUE_LIMIT_JOBS', 3);

    JOBQUEUE_LIMIT_M_EXPORTE describes the number of items exported per export format and Cron task call. Here you can enter values of several thousands.

     JOBQUEUE_LIMIT_JOBS is the number of Cron tasks that are started one after the other via call.

    With external Cron services (such as www.cronjob.de), it is sufficient to start the php script via URL call:
    Example:

    http://www.meinshop.de/includes/cron_inc.php

    By default, 500 items per call are processed for export formats. This means that if you have entered 800 items and two export formats in the task scheduler, the Cron task must be started twice so that all tasks can be processed. Depending on the server capacity, you should allow a suitable amount of time between calls (approx. 2 minutes). You should choose a time period for calling the Cron tasks when as few shop visitors as possible are online.

    Best practices: task scheduler and Cron tasks

    For a smooth processing of tasks, the following things should be considered:

    • Ensure that an export task can be processed quickly. Depending on the quantity of items, the task scheduler must be triggered several times in succession at short intervals (e.g. within minutes) (see example above).
    • Ensure that not too many export tasks are running at the same time. The start times for export tasks should be chosen in such a way that the tasks can be completed one after the other (and not in parallel) without any problems.
    • Separate peak visitor times and export task times. Larger tasks should run at night so that during the day when most visitors are online, the full server power is available for the normal operation of the online shop.