fetch command sending STDOUT to STDERR

2003-08-01 Thread Peter Elsner
For some time now, I've been using FTP to transfer files from one
server to another.  I recently decided to update my script to use fetch
instead of FTP.
For some reason, the fetch command seems to be sending STDOUT
messages to STDERR.
I have a cron job that runs every 15 minutes and fetches some files,
the output from STDIN is:
96 bytes transferred in 0.0 seconds (1.24 MBps)
249 bytes transferred in 0.0 seconds (2.70 MBps)
However, I have the STDOUT redirected to a file name in /tmp report.out
and STDERR redirected to a file name in /tmp report.err
My script then checks to see if report.err is greater than 0 bytes.

If it's not, the script exits cleanly (it should), if it is greater than 0 
bytes,
it sends me an email stating that the file transfer failed, and appends the
report.err file.

Here is my cron entry:

*/15 * * * * /home/reports/reports.sh /tmp/reports.out 2/tmp/reports.err

For the time being, I've redirected STDERR to /dev/null which will stop
the problem.  However, if the transfer fails, I won't know about it either...
Is this normal for fetch?

Peter



Peter Elsner [EMAIL PROTECTED]
Vice President Of Customer Service (And System Administrator)
1835 S. Carrier Parkway
Grand Prairie, Texas 75051
(972) 263-2080 - Voice
(972) 263-2082 - Fax
(972) 489-4838 - Cell Phone
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: fetch command sending STDOUT to STDERR

2003-08-01 Thread Daan Vreeken [PA4DAN]
On Friday 01 August 2003 22:54, Peter Elsner wrote:
 For some time now, I've been using FTP to transfer files from one
 server to another.  I recently decided to update my script to use fetch
 instead of FTP.

 For some reason, the fetch command seems to be sending STDOUT
 messages to STDERR.

 I have a cron job that runs every 15 minutes and fetches some files,
 the output from STDIN is:
 96 bytes transferred in 0.0 seconds (1.24 MBps)
 249 bytes transferred in 0.0 seconds (2.70 MBps)

 However, I have the STDOUT redirected to a file name in /tmp report.out
 and STDERR redirected to a file name in /tmp report.err
 My script then checks to see if report.err is greater than 0 bytes.
 If it's not, the script exits cleanly (it should), if it is greater than 0
 bytes,
 it sends me an email stating that the file transfer failed, and appends the
 report.err file.

 Here is my cron entry:
 */15 * * * * /home/reports/reports.sh /tmp/reports.out 2/tmp/reports.err

 For the time being, I've redirected STDERR to /dev/null which will stop
 the problem.  However, if the transfer fails, I won't know about it
 either...

 Is this normal for fetch?
This won't answer your question, but maybe it will help you.
According to the manual page of fetch, fetch returns zero on successfull 
completion so maybe you could check the return value of the fetch operation 
something like this :

fetch -o /some/file http://some.url/ 2/tmp/report.err || do-mail-thing
(the do-mail-thing command will only be executed if the return value of fetch 
is non-zero)

grtz,
Daan
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]