LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 11-13-2008, 12:36 PM   #1
btuley
LQ Newbie
 
Registered: Nov 2008
Location: South Dakota
Distribution: Ubuntu
Posts: 1

Rep: Reputation: 0
shell prompt works, cron job fails


I have a command I need to invoke from my server.
when I type at a shell prompt:
/usr/bin/wget 'http://myserver/imp/index.php'
the command runs fine.

When I create a cron job usng the webmin interface:
I get:

Output from command /usr/bin/wget 'http://myserver/imp/index.php' ..

--11:12:55-- http://myserver/imp/index.php
=> `index.php'
Resolving myserver... failed: Name or service not known.

Why does this work at shell, and fail as cron? I'm executing the job as myself.
 
Old 11-13-2008, 12:40 PM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 15,098

Rep: Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719Reputation: 2719
Quote:
Originally Posted by btuley View Post
I have a command I need to invoke from my server.
when I type at a shell prompt:
/usr/bin/wget 'http://myserver/imp/index.php'
the command runs fine.

When I create a cron job usng the webmin interface:
I get:

Output from command /usr/bin/wget 'http://myserver/imp/index.php' ..

--11:12:55-- http://myserver/imp/index.php
=> `index.php'
Resolving myserver... failed: Name or service not known.

Why does this work at shell, and fail as cron? I'm executing the job as myself.
Do you have a proxy server? Have a .wgetrc file set up, or a .netrc, to handle proxy settings/authentication? If you put the job into root CRON, those files won't exist...so it'll not get to the internet, and die.

If this job runs as you now, set your personal CRON up to run it, and it may use your settings. Since you don't say anything about your environment, it's hard to give any further details.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues while executing shell scripts through Cron job paragkalra Programming 8 08-02-2008 02:18 PM
Command not working in cron job, but works fine in root Roosta21 Linux - Software 4 11-22-2007 09:08 AM
Script works when run manually but not in cron job Harlin Linux - Software 7 10-16-2007 07:36 PM
Command works in shell, fails as a cron task angeljusto Linux - Software 3 06-13-2007 08:06 AM
shell script fo run auto job in cron JolynnMarie LinuxQuestions.org Member Intro 0 04-28-2004 12:21 PM


All times are GMT -5. The time now is 05:12 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration