X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Cron for Html Catalog Generation? (https://forum.x-cart.com/showthread.php?t=7287)

adpboss 04-23-2004 02:44 PM

Cron for Html Catalog Generation?
 
Anyone want to give me a starting point to set up a cron job to run the html catalog? I don't know how to call the script.

Would be a big help... :D

finestshops 05-03-2004 05:46 AM

Re: Cron for Html Catalog Generation?
 
Quote:

Originally Posted by adpboss
Anyone want to give me a starting point to set up a cron job to run the html catalog? I don't know how to call the script.

Would be a big help... :D


Here is the line we are using:

05 02 * * * cd /home/path_to_your_account/x-cart/admin; /usr/local/bin/php -q -f html_catalog.php

You'll need to comment out this line:

Code:

# require $xcart_dir."/include/security.php";

adpboss 05-03-2004 05:52 PM

Thank you Anton. You rock as usual.

NuAlpha 06-16-2004 01:46 PM

Any idea how to pass a variable from the commandline via a cronjob?

I would prefer to have an IF clause that disregards the security.php line if passed a variable instead of commenting it out.

I have tried this before, but can't seem to get it working.

Thanks!

NuAlpha 06-16-2004 01:53 PM

Also, will there be any problems if a link to the HTML catalog is already available on the main site page?

Jon 06-16-2004 06:44 PM

Perhaps make a copy of the php file, remove the security.php include, use full paths to everything, and then tuck the file below directory root?

NuAlpha 06-24-2004 08:48 AM

Tried using 27stars post but I soon discovered it wasn't actually creating the catalog, but merely loading the page. Learned this from trying to run the HTML catalog script from the commandline...all that happened was that the html code for that page loaded. So I adapted the code a little and here is what we are using.

Replaced:
Code:

require $xcart_dir."/include/security.php";

With:
Code:

if ($_SERVER['argv'][1] != 'CatalogCron')
        require $xcart_dir."/include/security.php";
else {
        $REQUEST_METHOD = 'POST';
        $mode = 'catalog_gen';
        $namestyle = 'hyphen';
        $process_subcats = 'checked';
        $pages_per_pass = 0;
        $gen_action = 3;
}


Use the cron (or something similar):
Code:

05 02 * * * cd /home/path_to_your_account/x-cart/admin; /usr/local/bin/php -q -f html_catalog.php CatalogCron

Please note that your PHP setup must have argv registered. If it doesn't, you can add php_value register_argc_argv 1 to your .htaccess file to enable it.

finestshops 06-24-2004 11:11 AM

Quote:

Originally Posted by NuAlpha
Tried using 27stars post but I soon discovered it wasn't actually creating the catalog, but merely loading the page.


:oops: Sorry, forgot to mention you have to remove a couple of "if" statements and rename the script to use it as cron - we use a custom cron generator to put pages in root.
but your solution looks good. I did see the code for auto identification of script running in shell, so you do not have to pass any variables at all. If you need it, try to search for cron db_backup.php in this forum.

NuAlpha 06-24-2004 05:38 PM

8O For some reason the HTML catalog is creating hundreds of sessionids. We are at 790 and climbing rapidly. I do not know if this is from running it as a cronjob or what.

Anyone else experienced this?? :-k

adpboss 08-17-2004 09:10 PM

For anyone that is interested, Garry from X-Cart Plus whipped me up some 3.4 and 3.5 HTML Cron Scripts that are a dream to setup and run. He charged a fair price for something that makes your life much easier.

You can PM GarryHS here.


All times are GMT -8. The time now is 01:42 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.