Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Cron for Html Catalog Generation?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-23-2004, 02:44 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default 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...
Reply With Quote
  #2  
Old 05-03-2004, 05:46 AM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default 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...

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";
__________________
Best regards,

Anton Pachkine
X-cart.hosting
Reply With Quote

The following user thanks finestshops for this useful post:
extera (11-13-2009)
  #3  
Old 05-03-2004, 05:52 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Thank you Anton. You rock as usual.
Reply With Quote
  #4  
Old 06-16-2004, 01:46 PM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

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!
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #5  
Old 06-16-2004, 01:53 PM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

Also, will there be any problems if a link to the HTML catalog is already available on the main site page?
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #6  
Old 06-16-2004, 06:44 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

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?
Reply With Quote
  #7  
Old 06-24-2004, 08:48 AM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

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.
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #8  
Old 06-24-2004, 11:11 AM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default

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.

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.
__________________
Best regards,

Anton Pachkine
X-cart.hosting
Reply With Quote
  #9  
Old 06-24-2004, 05:38 PM
 
NuAlpha NuAlpha is offline
 

X-Adept
  
Join Date: Aug 2003
Location: US
Posts: 598
 

Default

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??
__________________
X-Cart Pro 4.5.5 Platinum
X-Payments 1.0.6
PHP 5.3.14
MySQL 5.1.68
Apache 2.2.23
Reply With Quote
  #10  
Old 08-17-2004, 09:10 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

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.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:50 PM.

   

 
X-Cart forums © 2001-2020