No internet access from crontab linux

Hi all,

I've a weird problem. I've a php script that resides on a server. That script is started from a bash script on a suse linux 11.2 server. The last script is started from the crontab. Both servers are behind a Corporate firewall / websense proxy.
In this php script several rss feeds are read from the internet. when I start this script  from kcrontab (on the linuz server) by right mouse click and click "Run Now". The rss feeds are read and there are no problems. When the script is run by the crontab on the scheduled time (i've tested several different times). Then it isn't able to connect to the internet. I see errors like: could not resolve hostname (name of the rss feed provider)..

Can anyone help?

Best regards,

Ben Tuinstra

skgsfAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Artysystem administratorCommented:
Hi.

Websebse authenticates your IP address for some short time period (30 minutes), so I see 2 reasons of such problem:
 
1) When you run it from bash you are already authenticated on a websense, while when it runs from scheduler - your IP is not authenticated... To check, try to wait some time (until you will be deauthenticated by websense), then try to run it from bash (before your first try to access Internet from web). If script fails - that's the reason.

2) You have a proxy set in your bash enviroment and no proxy in crontab. To check it: run bash, run 'echo $http_proxy'. If you have the a proxy set, set it to the same value in crontab.

Regards,
Arty
skgsfAuthor Commented:
Hi Arty,

Thanks for your support. By checking all kinds of timing I can tell you that the first solution is not the case. But the second could be. I don't know how to set the http_proxy variable in crontab. Can you give me a hint?

Best regards,

Ben
Artysystem administratorCommented:
just put it at the first line in crontab:

http_proxy=http://blabla
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Artysystem administratorCommented:
or if you are using login/password:

http_proxy=http://user@password:proxy_addr/
Artysystem administratorCommented:
oops, should be: user:password@proxy_addr

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skgsfAuthor Commented:
Hi Arte,

Thank you very much. Your answer (adding the proxy to the crotab) has solved the issue. I'm very happy with that.

Best reagrds,

Ben
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.