1. conquist
  2. RO CSVI
  3. Wednesday, 06 April 2016
  4.  Subscribe via email
Hi, I'm trying my first export with cron job.

COMMAND:
/var/www/vhosts/system/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_name="MYNAMETEMPLATE"‏
ERROR BY EMAIL:
/bin/sh: /var/www/vhosts/system/MYNAME/administrator/components/com_csvi/helper/cron.php: No such file or directory

Help me, please.

I'm using CSV 6.4.3, Virtuemart 3.0.12, Joomla 3.4.5.
Accepted Answer Pending Moderation
Hello,
The path to the PHP executable in your cron command is missing. Have a look at the the documentation on setting up the cron job.
Kind regards,

Tharuna

=========================
If you use CSVI, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hi tharuna thanks !!

NEW COMMAND:
php /var/www/vhosts/system/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_id="MYIDTEMPLATE"‏

Works well !!

But I've another problem.

The output csv file is always rewrited, i need, if it exists, do not delete but append it.
Is it possible ?
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
Hello,

This is not possible. CSVI always writes a new file. The only way around it is that you create a filename that has a timestamp for example. Have a look at the Customizing the export filename document.
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
Thanks Roland, I've another two questions:

1. Is it possible to delete the input csv file after an import?

2. How can I set the range of date for export "customers" and "orders" ?
  1. more than a month ago
  2. RO CSVI
  3. # 4
Accepted Answer Pending Moderation
Hello,

Is it possible to delete the input csv file after an import?
This depends. If you are loading the file From Server, and you click on the Advanced button you will see the option to Delete the file after import. Deleting From URL isn't possible and From FTP isn't implemented yet.

How can I set the range of date for export "customers" and "orders" ?
In your template on the Options tab you can set a date range.
  1. more than a month ago
  2. RO CSVI
  3. # 5
Accepted Answer Pending Moderation
Hi Roland, I'm not clear.

I'm using cron job and i try to repeat my questions:

1. How can I delete a csv file after an import using cron job ?

2. Every day I need to export only users or orders created the day befroe. Is there an option or a filter in cron line command ?

Thanks.
  1. more than a month ago
  2. RO CSVI
  3. # 6
Accepted Answer Pending Moderation
Hello,

How can I delete a csv file after an import using cron job ?
Same answer as before. If you want to control it yourself, you will need to create a bash script to do so.

Every day I need to export only users or orders created the day befroe. Is there an option or a filter in cron line command ?
For orders you have the option in your template to export "Since last run", this is usually used to get the last batch of items.

For customers you will need to do it on the command line as this doesn't have the "Since last run" option. The Setting up a cron-job explains how to add command line arguments.

To use a date you will need to use the system functions to generate the date for you. There are quite a few posts about that on the forum but people in general use something like this
 --form.orderdatestart=$(date -v-5d +"\%d-\%m-\%Y")
You will need to find out for yourself how it works on your server.
  1. more than a month ago
  2. RO CSVI
  3. # 7
Accepted Answer Pending Moderation
Hi, I don't have the key cron in my template options. I need to set "User modified date" from command line and this --form.orderdatestart=$(date -v-5d +"\%d-\%m-\%Y";) don't work.

[root@admin49178387 ~]# php /var/www/vhosts/admin49178387.localhost/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_id="1" --form.orderdatestart$(date -v-5d +"\%d-\%m-\%Y";)
date: invalid option -- 'v'
Try `date --help' for more information.
Use --help to see the help information
Processing started...
Template ESPORTA CLIENTI
Attachments (2)
  1. more than a month ago
  2. RO CSVI
  3. # 8
Accepted Answer Pending Moderation
Hello,

I don't have the key cron in my template options.
You don't have CSVI 6 installed? Older CSVI versions are no longer supported, so an update is recommended. Make sure you follow the update guide of CSVI 6.

form.orderdatestart=$(date -v-5d +"\%d-\%m-\%Y";) don't work
This was a suggestion, I wasn't implying that this would work just others have used it. This is no longer CSVI code but has to do with your server operating system.

You will need to find out which works for your server, perhaps ask your hosting provider.

Test the code you want to use, since you have SSH access that is the easiest way to do it. The date command should output a date in the format of day-month-year (example: 31-12-2015).
  1. more than a month ago
  2. RO CSVI
  3. # 9
Accepted Answer Pending Moderation
Hi Roland, now I've installed CSVI 6.5.6 - Joomla 3.5.1 - Virtuemart 3.0.12 and I see the key CRON.

I'm not able to set command line for the date.

When I set the date inside the template it works well.

The problem is that CRON.PHP don't read the date from command line.

Mi server says that date +"%m-%d-%Y" is OK.

This is the last test:
php /var/www/vhosts/admin49178387.localhost/MYNAME/administrator/components/com_csvi/helper/cron.php --key="MYKEY" --template_id="1" --form.userinfomdatestart=$(date +"%m-%d-%Y";)

When I see the log of CSV IMPROVED using the template from backoffice the field (for example) is
2016-04-13 09:58:38 0 [DEBUG] userinfomdatestart: 01-01-2016 11:48:12

When I see the log of CSV IMPROVED using CRON.PHP the field userinfomdatestart is empty.
2016-04-13 10:09:57 0 [DEBUG] userinfomdatestart:

Help me, please :(
  1. more than a month ago
  2. RO CSVI
  3. # 10
Accepted Answer Pending Moderation
Hi Roland, another problem.

The option "delete after import" do not work !!.
  1. more than a month ago
  2. RO CSVI
  3. # 11
Accepted Answer Pending Moderation
Hello,

The problem is that CRON.PHP don't read the date from command line.
Well the question is if there is any date actually supplied. Did you check by specifying the date directly into the command line? Like this:
php /var/www/vhosts/admin49178387.localhost/http://quorestore.it/administrator/components/com_csvi/helper/cron.php --key="mafrat" --template_id="1" --form.userinfomdatestart="01-01-2016"
In your command you are missing the " around the date value.

The option "delete after import" do not work !!.
That is another question for another thread. Supply more information than "It doesn't work", I can't help you if that is all you tell me. Make a new thread and post the information requested under Looking for a useful answer?.
  1. more than a month ago
  2. RO CSVI
  3. # 12
Accepted Answer Pending Moderation
hi,
I have just launched this command but not work. it is as if this parameter was not read, while if I value this field in the template it work.
Attachments (1)
  1. more than a month ago
  2. RO CSVI
  3. # 13
Accepted Answer Pending Moderation
Hello,

The debug log tells me something very interesting: PHP version: 5.3.3

CSVI requires a minimum of PHP verison 5.4, so I think you will need to adjust your cron command to use a newer PHP version. Usually this is located in a place like /usr/bin/php but you may need to ask your host for the exact path.

So let's use an up-to-date PHP version first and then see what happens. Although PHP 5.4 is out of support as well by the PHP developers :)
  1. more than a month ago
  2. RO CSVI
  3. # 14
Accepted Answer Pending Moderation
Thanks Roland, for your great help, I really appreciated it.

With php version 5.4 it works well.

Here is our correct command line:
php /var/www/vhosts/admin49178387.localhost/myname/administrator/components/com_csvi/helper/cron.php --key="mykey" --template_id="1" --form.userinfomdatestart=$(date --date="1 days ago";)

I hope, as soon as possible, to have the option to append export csv file and not only to delete it if exists.
What do you think about this ?
  1. more than a month ago
  2. RO CSVI
  3. # 15
Accepted Answer Pending Moderation
Hello,

Thank you for giving your solution.

As for appending the output, I am not sure, this is the first time this has been asked and I don't see the true benefit of it. If you are appending, you may was well change the date from when it needs to be exported. For example, on Monday you export Monday and on Tuesday you export Tuesday but you want this appended to the Monday export. Why not export Monday and Tuesday on Tuesday?
  1. more than a month ago
  2. RO CSVI
  3. # 16
Accepted Answer Pending Moderation
Hi Roland I try to explain.

Every night there is the export, using CSV IMPROVED, of users and orders and, the
files, are sent by ftp.

After the export there is another software of another company that read and copy the files inside his procedure, if this software works well the files are deleted otherwise, if this software fails or not run, the export files remain good for the next night.

In this case I need append new data to the existing files to don't lose data.


Every night there is the import, using CSV IMPROVED, of products and trackingorders and the files are taked from ftp.

At the end of import i need to delete the files: to do this you told me that CSV IMPROVED is not able to delete by ftp and I wrote a script that runs at the end of schedulation by cron.

All must work well automatically.

Thanks for the help.
  1. more than a month ago
  2. RO CSVI
  3. # 17
Accepted Answer Pending Moderation
Hello,

The software of the other company that pulls the export files from FTP, can it handle multiple files in a single folder? If that is possible, you could have CSVI create unique files per day. That way you could see which files are actually processed and which ones are not. If they failed, they could try again.

As for deleting the file from FTP, that is on our todo list.
  1. more than a month ago
  2. RO CSVI
  3. # 18
Accepted Answer Pending Moderation
Unfortunately the software of the other company that pulls the export files from FTP, cannot handle multiple files in a single folder. :( I had already thought !!

For deleting the file from FTP I'm waiting the next release.
  1. more than a month ago
  2. RO CSVI
  3. # 19
Accepted Answer Pending Moderation
Hello,

So we have to change something because they can't handle it :) You can modify the core file administrator\components\com_csvi\models\exports.php by finding this line
$this->handle = fopen($this->processfile, 'w+');
and change it to
$this->handle = fopen($this->processfile, 'a+');
see if that works for you.
  1. more than a month ago
  2. RO CSVI
  3. # 20
  • Page :
  • 1
  • 2
  • 3


There are no replies made for this post yet.
Be one of the first to reply to this post!