Support is offline. We are back Friday 27 November, 09:00.

Cron Issue #8615

Open imthebige opened this topic Tuesday, 01 November 2016 ยท 36 replies
Author

Hello,

As i mentioned in my earlier messages about cron issue that importing wrong entries in database.

category_path has been processed like Process path: product category/2016-10-25T10:43:26-07:00 which is product_modified date value in my import file.

Added like this way : category

2016-10-27 05:00:05
2016-10-27 05:00:05
2016-10-27 05:00:05
2016-10-27 05:00:05
2016-10-27 05:00:05
2016-10-27 05:00:05
2016-10-27 05:00:05

This is a old issue : https://csvimproved.com/forum?view=topic&catid=44&id=33529

As per Tharuna I emailed him all the details of my website earlier.and according to him :-

both the cron jobs running at same time. i think that would be a cause, why cant both cron run with some time difference? Try it and let me know.

So i send you my cron email timings below and cron url Please check

  1. Product Cron job : Run (Once per 15 minutes)

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="testimport" --template_id="51" --file="/home/juicy672/public_html/cron/Tmpfile.csv"

2)Brands Cron job : Run (Once per hour)

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="Final Brand Cron" --template_id="56" --file="/home/juicy672/public_html/cron/1.csv"

See the screenshot : http://prntscr.com/d1jay9

http://prntscr.com/d1jb6d

Thanks & Regards

Support

Hello,

Thanks for the detailed explanation but the debug log is missing of your cron import. Please post those as well.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,
*
category_path has been processed like Process path: product category/2016-11-03T11:48:37-07:00 which is product_modified date value in my import file.*

Added like this way : category

2016-11-03T11:48:37-07:00
2016-11-03T11:39:51-07:00
2016-11-03T10:56:24-07:00
2016-11-03T10:44:24-07:00
2016-11-03T11:48:47-07:00

This issue is with cron job

Below is my cron Url's :-

  1. Product Cron job : Run (Once per day)

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="testimport" --template_id="51" --file="/home/juicy672/public_html/cron/Tmpfile.csv"

2)Brands Cron job : Run (Once per week)

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="Final Brand Cron" --template_id="56" --file="/home/juicy672/public_html/cron/1.csv"

**If the first cron job run only then it will be working fine.But when second cron job run in any of day then this problem occur.
category_path has been processed like Process path: product category/2016-11-03T11:48:37-07:00
**
I don't know what is going wrong with cron job...:(

See the screenshot : http://prntscr.com/d41kgk
http://prntscr.com/d41mwh
http://prntscr.com/d41n07

I have attached my debug log file also for both products and brands,also attached templates + csv

Please check this and let me know if you need any other thing to check.

Thanks & Regards

Support

Hello,

I have merged your new topic with the old one that is still open where I was waiting for you to post the debug log. Now that I have the debug log let's see what we have.

In your 1.csv file you have the following columns (I stopped at PrimaryCategory) and let's match them with the fields in your template:
MerchantID - product_code
MerchantName - brand
Network - skip
NetworkID - network
NetworkNotes - product_name
DualMerchant - couponcode
RelatedMerchants - file_path
ParentMerchantID - enddate
AffiliateURL - getdeal
SkimlinksURL - skip
HomepageURL - skip
Status - skip
Added - category_path
LastUpdated - dealtypes
SelectedStatus - product_delete
RelationshipStatus - product_created
PrimaryCountry - product_modified
ShipsToCountries - product_price
APOFPO - product_msrp
PrimaryCategory - dollaroff

As you can see most of the fields don't really match up with the correct fields. Your category_path field matches the Added field, the Added field contains a date, that is why you see a date as category.

So you will need to update your template to match the fields correctly in your import file.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello Rolandd,

Thanks.. I will try it and let you know if it works or not.

Regards

Author

Hello Roland,

1.csv is for brands to import column are correct but mapping is done with products column.how is that possible ?
Both templates and its fields are different.

For products ->Used Tmpfile.csv
For Brands ->Used 1.csv

At cron time for brands it take column of products csv which is weird.Product_code,brand,couponcode etc all these are mapping of products csv column.

MerchantID - product_code
MerchantName - brand
DualMerchant - couponcode
RelatedMerchants - file_path

Apart from all this Though I again created New template for it.

1)I have created new field mapper "Brands" and mapping the fields

See the screenshot : http://prntscr.com/d431e4
http://prntscr.com/d431iu

2)I have added template "Brands" for field mapper - Brands.

3)In Template fields by selecting template = "Brands".I have added 3 fields more which are not in my csv.

4)Now changed the cron url as per new template-

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="Brands" --template_id="59" --file="/home/juicy672/public_html/cron/1.csv"

Please check this screenshot : http://prntscr.com/d440yf

***Problem is that brand is import with product csv but why this happened ? as for both there is different template,csv files.

Please check

Thanks & Regards.

Support

Hello,

1.csv is for brands to import column are correct but mapping is done with products column.how is that possible ?

Perhaps naming the files a bit more appropriate will help me understand what is what. A name like 1.csv doesn't mean anything to me but if it is brands.csv it is easier to make a connection.

Let's focus on 1 import first, the brand import because it is confusing me with 2 different imports. I see you have the filename in the cronjob, why not add it to the template itself? That will be easier to change if needed and it will prevent confusion as to know which file is being read. Can you make that change?

Is it correct that the brand import is a category type import?

When you do a category import, the category_path field is required to import a category. The category name alone is not enough. For example you sell shorts and you have the following categories Clothes/Men/Shorts and Clothes/Women/Shorts. When you set the category_name to Shorts, CSVI has no clue which category you mean, the Men or the Women.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

I have changed the names of my csv files.For Brands now-> Brands.csv and for Products->Products.csv file is used.

According to my need Both csv runs once per day to import as these are updating on my server every day.

And If only one cron job runs then no problem occurs to me so how can i focus on 1 import first..:) ,problem is occured when 2nd cron runs after one.

One cron file runs fine.But manufaturer which is brands update everyday in csv so need to import brands file with cron everyday.
Also products update everyday in products.csv file so need to import products also with cron everyday.

When i run products cron job only then it will work fine no issue there.But when after sometinme if brands cron url run then there is a problem

MerchantID - product_code
MerchantName - brand
Network - skip
NetworkID - network
NetworkNotes - product_name

As you can see MerchantID is with product_code how is it possible because MerchantId column is in brands.csv and mapping this field with skip.product_code is a column is products.csv file.

See the screenshot : http://prntscr.com/d45q6q

Hope now you will understand it..:)

Regarding : Is it correct that the brand import is a category type import?

->I have category_path field to import a brand in template for Brands.

So that they will go as like : manufacturer/Category_name.

See the screenshot : http://prntscr.com/d45qq5
http://prntscr.com/d45wab

If you need anything else.Please let me know.As this is important for me to run both cron url's once in a day.

Thanks & Regards.

Support

Hello,

According to my need Both csv runs once per day to import as these are updating on my server every day.

I understand, that shouldn't be a problem.

problem is occured when 2nd cron runs after one.

Ah ok, I had another idea. I thought that running the same cron job more than once caused the issue you see.

So when the Brands import runs, it uses the Products file, correct?

Does the problem happen when you specify the file in the template and not in the cron command?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

Regarding : So when the Brands import runs, it uses the Products file, correct?

->yes now you get it finally.. :)

Regarding : Does the problem happen when you specify the file in the template and not in the cron command?

->No when i import from backend it will import correctly.But in cron command it will not work

Regards

Support

Hello,

Great, I get it :silly:

->No when i import from backend it will import correctly.But in cron command it will not work

That is not what I meant. If you edit your template and go to the Source tab, you can set the Source to Load from server. Put in the path and the name to the file you want to import and save your template. Remove the file from the cron command and see how it goes.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

Regarding : Put in the path and the name to the file you want to import and save your template.

See the screenshot : http://prntscr.com/d46b7d

Regarding : Remove the file from the cron command and see how it goes.

Dear it goes fine.I have checked it already.No problem with that one.

Regards

Support

Hello,

Have you updated the cron command as well by removing the filename? If yes, does the cron import the correct file?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

filename is not in my cron url .Please check below

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="Brands" --template_id="59" --file="/home/juicy672/public_html/cron/Brands.csv

There is template_id i think

Support

Hello,

Yes, you have a filename in your cron command, that is the --file="/home/juicy672/public_html/cron/Brands.csv part. You're cron command should look like this:

/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="Brands" --template_id="59"

The filename will come from the template.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

Ok Understood.. :) ..Fron both cron url ?? products or brands ??

Support

Hello,

Yes, both as you should have the filename for both in the template itself.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

Ok i will check this..and let you know what happened..Thanks

Author

Hello Roland,

I am checking it, 2-3 times cron import correct file but the recently again it import wrong file.

See the screenshot : http://prntscr.com/d4htbn

I don't understand sometimes it pick correct one while sometimes wrong one..:(

Can you please check

Thanks

Author

Hello,

Again it works fine for 3 times and for 4th time again import incorrect file.

see the screenshot : http://prntscr.com/d4iaxo
http://prntscr.com/d4ibxa

Why it is not recognize a correct file ? In Template there is different file for both products and brands.

Support

Hello,

Why it is not recognize a correct file ?

Honestly, it makes no sense to me. It almost seems there is some sort of caching going on. What is also weird, it is only the brands import that goes wrong. The product import never takes the brands file.

How have you setup the cron jobs now? Can you post the debug log of a failed brands import?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Support

Hello,

There is something else coming to mind, can you check if the table csvi_processes has any data in them? If yes, can you empty that table and see if that solves the problem?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi,

yes,It has no sense to me as well.But you can see in the screenshot which i send you earlier that sometimes it take correct file or sometimes it not :( which is weird.

Cron job set up now as :

  1. /usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="Brands" --template_id="59"

2)/usr/local/bin/php70 /home/juicy672/public_html/administrator/components/com_csvi/helper/cron.php --key="testimport" --template_id="51"

See the screenshot : http://prntscr.com/d4isz1

I am posting debug log files for failed brands import.

Yes there is data in csvi_processes table.Okay i will check it with this and let you know what happened

Please find and check

Regards

Support

Hello,

This debug log shows that everything is OK. There are no weird categories created according to this debug log. Perhaps the wrong log?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

:huh:

I have checked with empty the csvi_processes table also.But still same issue occured.Really it becomes headache now.

I have send you the log file of template name- brands and file which is imported products.csv file but it shows that everything is OK.

Now i am sending you the log file of template name-Final cron import which is imported products.csv file.Here i can see the wired categories.

Please check a log file which i am attaching now.

Also i am thinking that is this is a time problem for cron ?? At what time of gap both should be run ?? Any suggestions ?

Thanks

Support

Hello,

I figured it all out. We asked you before to set the cron jobs to not run on the same time but in the debug logs I have seen you do run the cron jobs at exactly the same time.

You have set both cron jobs to run at 0 0, which means both jobs runs at midnight 00:00. In another screenshot you sent us, you had set the time for the product import to */15 and the time for the brand import to 0. This means that the product import runs every 15 minutes, so that is 15/30/45/0 and the brand import only runs on 0. So you will get 3 imports that are ok and 1 that is not OK because on 0 they both run at the same time.

So if you change one cron job to run at 5 0 and the other on 0 0, they won't run at the same time and the import should be fine.

As the jobs run at exactly the same time, CSVI creates a temporary folder based on the time it is run. Now your jobs run at the same time so whichever job comes second will use the temporary folder of the job that came first and mess up the import. I am going to make a change to the script to prevent this from happening and post the solution here when done.

Do you want any of the jobs to run more than once per hour?

Edit:
I have attached a patchfile that you can load. After that you should be able to run the cron jobs at the same time.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hello,

Sounds Good...I also thought there was problem with time somewhere..:)

Regarding : Do you want any of the jobs to run more than once per hour?

->No I don't want any of the cron jobs to run more than once per hour.I am changing time to just check it one file time i used after 10 minutes or 5 minutes and other after 15 mins or 20 minutes .so by this way may be jobs run at exactly the same time.I am just testing the cron job by changing the time so no need to wait for hours. but in actually i need cron jobs to run once per hour.

Regarding : So if you change one cron job to run at 5 0 and the other on 0 0, they won't run at the same time and the import should be fine.

->Can i try this one.Is this really working fine ? 0 0 means once per day ?? or once per hour ?

Regarding : I am going to make a change to the script to prevent this from happening and post the solution here when done.

->Thanks for it.I am waiting..:)

Regards

Author

Hello Roland,

Thanks for the patch file.I want to know is need to empty the tables in database after patch file uploaded and then do import ??

Support

Hello,

No need to empty the tables in the database, you can load the patch file and then run your imports.

->Can i try this one.Is this really working fine ? 0 0 means once per day ?? or once per hour ?

Look at your crob job settings, you already have it ;) First 0 is minutes and second 0 is hours. That means once per day as you only have midnight once every 24 hours. If you want it to run once per hour, just set 0 for minutes and * for hour.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Hello, I have a problem with a cron job for exporting virtuemart products to an xml file.
I have configured the cron through cpanel with the following command:

/usr/local/bin/php /home/mydomain/public_html/administrator/components/com_csvi/helper/cron.php --key="mykey" --template_id="1"

The log email reports the following error:

Use --help to see the help information
Processing started...
Template XML

Fatal error: Call to a member function add() on null in /home/mydomain/public_html/administrator/components/com_csvi/helper/cron.php on line 377

I use Joomla 3.6.4, PHP 5.6.27, CSVI Pro 6.6.4.
What can I do?

Support

Hello,

There is an issue with cron export when an error has occured. This error message cannot be written to the log, that is why you see the error.

You can load the attached patch file that should solve the fatal error you see.

This won't solve the other error you get but at least we will be able to see what that error is. Can you give this a run and let me know what you find?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Hi, I added the patch. Now it shows the following error:

Processing started...
Template xml
The apcu Cache Storage is not supported on this platform.

If I disable the joomla cache, then the export is finished correctly.
So, I see that apcu or apc cache breaks the cron. Why?

Author

Hello Roland,

I have attached the patch file given by you and check the import with the cron time.Now It is working fine.No mess up in cron import now..:)

Thanks so much.Appreciate your help..:)

KInd Regards

Support

@imthebige Thank you for hanging in while we sorted out the issue. Glad to hear we did find the cause and were able to solve it.

@trabica Looking at the Joomla code, you need to enable apcu cache on the CLI instance of PHP as well. This is another PHP instance than the one used to run the website.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

@trabica Looking at the Joomla code, you need to enable apcu cache on the CLI instance of PHP as well. This is another PHP instance than the one used to run the website.

I have the apcu cache enabled in php settings in my cPanel. I checked it again, but it still has this problem.

Support

Hello,

I don't think that it is enough because via cPanel you control the PHP instance used for your webserver and not for the CLI. I do not know how to configure apcu but I would think that the php.ini used by the CLI instance should point to a valid apcu setup.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Hello, I told my hosting company and they turned apc.enable_cli to on. Now the cron works fine.
Thanks for your help!

Log in to reply to this topic.