Shop Data Sync Cronjob¶
Table of contents
Use this cronjob to automatically perform the Shop Data Synchronization.
ASA2 automatically determines which shops will be processed based on whether a data source is set up and whether the data freshness setting requires updating.
This cronjob runs the same process as clicking the big sync button on the shop data page.
To learn more about cronjobs in general, check out the Introduction chapter.
To learn more about setting up and using ASA2’s cronjobs, see the dedicated Cronjob Setup chapter.
The internal name of this cornjob is
Therefore, use it with the Server-side execution like this:
bash script.sh Asa2SyncShopData --shop_id=1,2,3 --verbose=1
$cronWrapper = new \Asa2\Cron\Wrapper('Asa2SyncShopData'); $cronWrapper->setOptions([ 'shop_id' => '1,2,3', 'verbose' => 1 ]); $cronWrapper->execute();
The REST API endpoint name of this cronjob is
Check Cron REST API for more details about running ASA2’s cronjobs via URL.
The frequency of execution should be adjusted to the data freshness setting (see Data Freshness) of all shops that have data. For example, if you set the data freshness for one shop to 12 hours, the cronjob should also run at least every 12 hours.
Also note the limit option. This should not prevent a regular update. For example, if you have two shops with a data freshness set to 6 hours and the cronjob runs every 12 hours with a limit of 1, one shop cannot be processed. Here the limit should be set to at least 2 or the cronjob should run every 6 hours.
If many shops with external CSV data sources are used, it is essential to ensure that the data synchronization process is adapted to the server capacities. If there are hundreds of thousands of records or more from all the shops combined, it may take a while to process them. This can bring the server to a certain load.
If it is a fairly powerful server, e.g. a dedicated server, all this should not be a problem and you can use system monitoring to check to what extent the performance limits are reached.
However, if it is a simple, inexpensive web hosting package, the server capacities are shared with other instances and it could lead to performance peaks if you synchronize all shop data at once. In this case, it would be better to use the shop_id option to create a single cronjob for each shop and run the jobs at different times over the course of the day (or better yet, only at night).
force option to start the synchronization although the shop data is still fresh.
bash script.sh Asa2SyncShopData --shop_id=42 --force=1
Prints a help text showing all available options and how to use them.
bash script.sh Asa2SyncShopData --help
Limits the amount of shops to be synchronized.
If this option is not used, all shops will be considered.
Example to raise the limit:
bash script.sh Asa2SyncShopData --limit=50
If you know what you are doing, you can turn off the limit with
Working without a limit may not be beneficial if you have a lot of shops in use, as the job could then load the system for a longer period of time.
Example to disable the limit:
bash script.sh Asa2SyncShopData --limit=-1
This option allows you to specify the shops that should be processed. This is useful, for example, if you want to have the data of a particular shop always updated at the same time. Multiple IDs can be specified separated by commas (without spaces!).
If no shop IDs are defined, ASA2 determines the shops automatically.
bash script.sh Asa2SyncShopData --shop_id=302,412
verbose option to get more information about the processed shops.
bash script.sh Asa2SyncShopData --shop_id=302,412 --verbose=1