skgsf
asked on
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
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
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
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