LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-26-2007, 10:26 PM   #1
kapster
LQ Newbie
 
Registered: Sep 2007
Posts: 2

Rep: Reputation: 0
wget does not work when called by cron


I have shell script that downloads a webpage using wget..
The abouve step works fine once I do a export http_proxy.

Now when I try to run the script using KCron....the wget does not work...I think I am missing some proxy settings with respect to cron.

Any pointers to solve this problem is appreciated

Thanks
 
Old 09-26-2007, 10:52 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
The environment in which cron runs scripts is not the same as the normal user, environment variables might not be present, and the PATH variable is going to be shorter.

When putting a script into cron, it is best to hardcode your variables, to be sure that it won't be missing some critical bit of information when it comes time to run. Also be sure to give the complete path to commands, so you would use "/usr/bin/wget" rather than just "wget".
 
Old 09-27-2007, 04:06 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
The point from MS3FGX is right. Regarding the proxy settings, you can simply put the http_proxy entry in your local configuration file $HOME/.wgetrc (if missing you can copy /etc/wgetrc to $HOME/.wgetrc and modify accordingly). wget should look for this file even from crontab execution.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using cron and wget to hit a php script 360 Programming 9 06-20-2012 05:03 PM
Weird interaction between wget and cron dinoman1989 Programming 2 07-11-2007 03:29 AM
setting up a php cron using wget Roosta21 Linux - Software 1 04-18-2007 07:29 AM
Can't get wget and lynx to work Buxworth Linux - Newbie 3 04-08-2006 04:31 PM
How do I make wget-1.9.1 work? akihandyman Linux - Software 2 11-26-2003 03:20 PM


All times are GMT -5. The time now is 08:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration