CRON Job Configuration in CS-Cart? - cPanel Configuration?

Hello,



One thing I’ve never found well documented, well not that but more “not obvious”, with CS-Cart was the set-up and configuration of CRON jobs. For example - What would be automated within CS-Cart and at what schedule.



Some years ago, being rather naive, we assumed many of the features below would be included in CS-Cart or the near future (v1.xx lol!), based on our experience with other eCommerce products. Having had clients provide us with feedback while others identifying a specific need, we assumed many of their requests and features would be implemented in due course (as were often available in other products, or custom modifications were required).





WISH LIST

Has anyone had experience and success with automation with any of these i[/i] ‘CRON’-based functions?



CRON Jobs run every x hour(s) to perform and trigger:[list]

[]Send emails regarding incomplete carts and their contents.

[
]Send bulk emails to a group of customers (perhaps staggered - xxx per hour) - the ‘Newsletter’ feature in CS-Cart,

[]Syncronise and update exchange rates of configured currencies,

[
]Creation, collation and compilation of various reports (built in or custom scope),

[]Export / create lists - such as Price Lists divided into various user group discounts,

[
]Get latest transactions from Paypal (and other payment gateways) and display in Admin Area (like an admin home page widget),

[]Send stock requisitions to suppliers (for stock under x, and approved to be included in auto requests sent to configured suppliers, and perhaps cheapest price [highest priority] supplier if more than one),

[
]Archiving system logs,

[]Backup of database,

[
]Optimisation of database,

[]Additional backup of database,

[
]Emailing / FTP transfer of backup,

[]Backup of /Images/,

[
]Backup of /Skins/,

[]Backup of /Addons/

[
]Even automatic restore of folders / database at set interval (perhaps for demonstrative or other reasons),

[/list]

The possibilities are endless (should some of these features be coded or modified).



Having a page to configure these schedules, e.g. for backups to be done every 12 hours, and something else every hour, when the CRON job runs, then obviously not eveything is triggered, only when x number of times between last run and next run are greater than current time (something like that)… This would mean a 30 Minute cron, would still only send 1 backup ever 12 hours (as example above).



Fingers are crossed!





MY QUESTION

So what is the point of the “example” CRON job in the admin area for? It seems fairly vague and useless? Or perhaps it is capable of the points above! Who knows?!



Admin Settings - CRON Example:

http:\www.company.com/admin.php?dispatch=profiles.password_reminder&cron_password=xyz



Okay, so this means trigger password reminders, but… shouldn’t they be sent out “instantly” upon password reminder / reset request? (rather than waiting for 3 hourly CRON or even 30 minute CRON?). (note: slashes reversed to stop forum created link in URL above)





SYNTAX

What options are available to be exchanged with “profiles.password_reminder” to support other functions?

http:\www.company.com/admin.php?dispatch=________________&cron_password=key_value





Thanks for your help, I’m willing to donate to anyone for their time should they have anything documented or even ‘‘developed’’ that can make the process easier! :)



Cheers!

Are you requesting a general cron-activity addon that woud perform these functions? There would have to be a lot of interest in order for someone to devote the effort into doing this. However, you'd still need cron entries for each time period you want these activities to run it and most are better run outside the cart.



Most of your requests can be done better and more easily in cron, idependent of cs-cart (like all the various backups).

The email stuff is better handled by a 3rd party email processor such as mailchimp.

I wouldn't bother with doing anything with their reports - most are pretty useless for any practical use.

No idea about what you mean by “system logs”. A log of cs-cart events is already in place.

Generally, html type parameters (those prefixed with '?' or '&' are not handled by cron correctly. Hence the use of syntax such as --password=foo which the command line php interperter will translate into a GET request of password=foo



I've posted cron interfaces here in the past, you should be able to search for it by 'cron_iface' or maybe just 'cron'. See message #8 here: datafeed 2.1.4 import - Upcoming features - CS-Cart Community Forums



A good host will backup your full cart and database weekly with daily incrementals. Hence much of what you want would be redundant.

I'm a sysadmin and not a cs-cart developer but I've seen many such road-block problems before.

People who want to fire URLs like this https://domain.com/adminxxx?dispatch=crons.order_report&cron_password=cronp4944 via CRON can use cURL instead. so you can setup your CRON job as

curl --insecure https://domain.com/adminxxx?dispatch=crons.order_report&cron_password=cronp4944

In general, cron jobs should not be going through the web server (I.e. no protocol) and should execute specific php files directly that provide for their own authentication. Note to pass parameters via cron you should use --parameter_name=value.

Obviously if you have a reason to use a webserver for a cron job, then by all means use curl or wget. For our addons that use cron, we suggest the following type of cron command:

cd public_html; php -q ./app/addons/addon_name/cron_iface.php --password=whatever

This assumes the cron job is setup to run as the cpanel account user so the current directory would be like /home/cpanel_user.