LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 02-19-2010, 11:09 PM   #1
shanthini
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Rep: Reputation: 0
Unhappy regarding wget command


Hi

I have set up a cron job in linux server using the command
'wget -q -o wget_outputlog http://www.mysite.com/php_file.php'

But on every run, an empty file being created at root.

How to stop this. Please suggest.

Thanks
Shanthini

Last edited by shanthini; 02-19-2010 at 11:11 PM.
 
Old 02-19-2010, 11:27 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Uh -

1. Specify a qualified path name?
2. Make sure the destination directory is writable by the "cron" user
3. Make sure you've thoroughly tested your script from the command line before trying to run it from cron?
4. Make sure you capture stdout, stderr (and thus possible error conditions) in your cron command?
 
Old 02-19-2010, 11:40 PM   #3
shanthini
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Hi

Thanks for your reply.

I am a php programmer and new to linux. In the linux control panel I need to configure cron job.

The cron process is for sending mails. Mails are getting sent and it is working fine.

The only problem is empty files are created at the root on every run. So I searched and from the link
http://www.sitepoint.com/forums/showthread.php?t=649601

they said that the output has to be directed to a file. So I placed a file wget_outputlog. The file 'wget_outputlog' was created at root. Apart from this it is creating files like

php_file.php
php_file1.php
php_file2.php and so on

But all are zero bytes.

Thanks in advance

Last edited by shanthini; 02-20-2010 at 12:12 AM.
 
Old 02-20-2010, 12:38 AM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
OK, let's focus on suggestion 3):

QUESTION:
What happens when you type your command (EXAMPLE: wget -q -o wget_outputlog http://www.mysite.com/php_file.php) from a command prompt (a terminal session)?

Are you "happy", or "sad"? Does it work, or does it fail? The same as from "cron", or different?
 
Old 02-20-2010, 01:30 AM   #5
shanthini
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for your reply

I created wget_outputlog at http://www.mysite.com/ and gave
'wget -q -o http://www.mysite.com/wget_outputlog http://www.mysite.com/php_file.php

But it tells the error no such file or directory

Also I tried -O /dev/null It is working. But again it started writing the empty files.

Please advice

Thanks

Last edited by shanthini; 02-20-2010 at 02:22 AM.
 
Old 02-20-2010, 01:33 PM   #6
BeacoN
Member
 
Registered: Nov 2008
Distribution: Linux Mint
Posts: 56

Rep: Reputation: 17
test URL

might want to test the URL, try...

curl -I http://www.mysite.com/php_file.php

and make sure you don't get 404.

maybe better luck with the curl command? To do the same thing with curl try...

curl http://www.mysite.com/php_file.php -O

might overwrite the file each time but I'd say try typing it in the command line to see if the problem is wget or else. If you don't get good output there then the problem isn't wget.
 
Old 02-21-2010, 09:54 PM   #7
shanthini
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Hi

Sorry I used small o when I changed to uppercase 'O' it started working

'-O /dev/null'

Thanks
 
  


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
wget command needs your help please help! muasif80 Linux - Newbie 8 12-17-2008 04:49 AM
Wget command help divyahm Linux - Software 12 09-04-2007 01:25 PM
wget command help munkeevegetable Linux - Newbie 8 11-03-2004 06:37 PM
wget command juanb Linux - General 5 12-11-2003 03:23 PM
wget command glock19 Linux - General 0 11-29-2001 02:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:06 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