Forums / All Other Contributions/Addons / Cron Jobs redirecting to login

Cron Jobs redirecting to login

Locked

Started by frano on 4 Oct 2009, 3:04 PM · Views: 2,394

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
4 Oct 2009, 3:04 PM
#1
frano avatar

frano

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Cron Jobs redirecting to login

hello,

I have the latest version of zen cart 1.3.8a.

I have been struggling with my host to get a cron job going for the currency updater, but look to have the server doing what it is supposed to do now.

However, the cron job appears to be failing.

A confirmation email is sent with the source code for the login page?

Is zen cart failing the cron job because it appears as though it is someone attempting to invoke the script who isnt logged in?

HAs anyone got cron jobs working for the currency update function?

( i have looked at the add ons but want to try and figure out the cron issue first)

Thanks

4 Oct 2009, 5:15 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Cron Jobs redirecting to login

Frano:

Is zen cart failing the cron job because it appears as though it is someone attempting to invoke the script who isnt logged in?
Most likely, yes.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

5 Oct 2009, 1:45 PM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Cron Jobs redirecting to login

Frano:

A confirmation email is sent with the source code for the login page?

Is zen cart failing the cron job because it appears as though it is someone attempting to invoke the script who isnt logged in?

Possible, but not something I've ever experienced.

Wouldn't this pretty much defeat the purpose of a cronjob?

Frano:

HAs anyone got cron jobs working for the currency update function?

Yes, on many different systems.

There are about 2 important things you need to set/check.

  1. The full path to the store admin directory needs to be set in the currency_update.php file itself.

  2. The crontab command line needs to be entered as

x x x x x php /file/path/to/currency_updater.php

where 'php' is the progam to be run, and the path is the parameter.

This example assumes the crontab is being edited by a user with the 'crontab -e' command. (or some other 'wrapper' program).

If you are the sysadmin with root access and editing /etc/crontab directly the line will need to read like:

x x x x x x root php /file/path/to/currency_updater.php

Generally when setting this up for the first time on any given server I first test it by running "php /file/path/to/currency_updater.php" from the command line. Only when this is successful do I add it to the crontab itself. I then set it to run every minute, set one of the currencys to something it shouldn't be, wait a minute, and if the currency has corrected itself I declare all ok and set it to run once daily.

Most problems I've experienced tend to be incorrect paths defined for the admin and program itself. On rare occasions I've needed to use the full pathname for the php executable (usually /usr/sbin/php), but this shows up on the command line tests.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

15 Oct 2009, 5:18 PM
#4
frano avatar

frano

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Re: Cron Jobs redirecting to login

Thanks for the advice, I still cant get this cron job working however.

I went back to my hosts and this was their reply:

I checked and the error is because of the ?variables you are adding. This either has to be done through a GET url or through a different string in the cron. Please check with the programmer or vendor of the script and let me know how they tell you to add it

Does that make sense to anyone?

Thanks

Francis

16 Oct 2009, 2:47 AM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Cron Jobs redirecting to login

Frano:

Thanks for the advice, I still cant get this cron job working however.

I went back to my hosts and this was their reply:

I checked and the error is because of the ?variables you are adding. This either has to be done through a GET url or through a different string in the cron. Please check with the programmer or vendor of the script and let me know how they tell you to add it

Does that make sense to anyone?

Thanks

Francis

No, it doesn't make sense to me unless you are actually trying to add variables to the cron command line, which as per my earlier post should look something like:

x x x x x php /file/path/to/currency_updater.php

Perhaps if you could give a little more information, such as a copy of the cron command that you are actually using. Any other error messages. What you have tried to solve the problem, eg: Adding quotes to the command string, trying a different path ... eg ~/some/path/currency_updater.php (as opposed to /some/path/currency_updater.php).

Another thing I'd be doing is adding something like

echo "Hello World" ; exit ;

near the top of currency_updater.php to check that cron is actually calling the program in the first place.

There really are LOTS of things you can do to try to solve this problem. We can only offer suggestions, and only you can do the actual debugging and testing.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

24 Oct 2009, 11:28 AM
#6
frano avatar

frano

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Re: Cron Jobs redirecting to login

Rod,

Thanks for the advice I will keep looking and see what I can come up with.

I dont have much experience with cron jobs but will act on your suggestions.

I am sure I will be posting again soon!

Thanks

28 Nov 2009, 2:58 PM
#7
frano avatar

frano

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Re: Cron Jobs redirecting to login

I am back working on this issue.../

can someone tell me where the currency_updater.php file is stored?

I cant seem to find it anywhere?

Thanks

Frano

28 Nov 2009, 3:50 PM
#8
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Cron Jobs redirecting to login

It appears that when you install the mod, you decide where that file goes. The instructions say to place it outside the web-accessible parts of your store for security reasons.

28 Nov 2009, 3:54 PM
#9
frano avatar

frano

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Re: Cron Jobs redirecting to login

Thanks for the reply.

However, I havent installed the mod for this?

I am just looking at using a cron to update the currencies instead of pressing the button in the admin?

Frano

28 Nov 2009, 7:58 PM
#10
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Cron Jobs redirecting to login

However, I havent installed the mod for this?

I am just looking at using a cron to update the currencies instead of pressing the button in the admin?
You can not cron a currency update directly in a cron tab.

You need to cron the excexution of a file that updates the currencies

Get the module
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=430

Zen-Venom Get Bitten

29 Nov 2009, 11:51 AM
#11
frano avatar

frano

New Zenner

Join Date:
Oct 2007
Posts:
25
Plugin Contributions:
0

Re: Cron Jobs redirecting to login

kobra,

thanks for the advice!

I did as you suggested and its working great now.

thanks for taking the time to point me in the right direction.

Frano