• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

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

0
skgsf
Asked:
skgsf
  • 4
  • 2
1 Solution
 
NopiusCommented:
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
0
 
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
0
 
NopiusCommented:
just put it at the first line in crontab:

http_proxy=http://blabla
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
NopiusCommented:
or if you are using login/password:

http_proxy=http://user@password:proxy_addr/
0
 
NopiusCommented:
oops, should be: user:password@proxy_addr
0
 
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now