How to redirect standard output of piped command to log file
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have this command in a bash script which record MP3 files in real time: sox -r 44100 -t ossdsp -w -s /dev/dsp -t raw -c 1 - | lame -s 44.1 -x -b 8 -m m --lowpass 5 -q 0 --quiet - $strFileName &
The script is called hourly from crontab so I get regular email with lame's messages. I want so save lame's messages to a log file instead of getting an email. I tried changing the command to: sox -r 44100 -t ossdsp -w -s /dev/dsp -t raw -c 1 - | lame -s 44.1 -x -b 8 -m m --lowpass 5 -q 0 --quiet - $strFileName >> /root/record.log &
All that happens is that now there is an empty file named record.log but lame's messages still get emailed to me. I also tried editing the crontab and having the script's output redirected to >> /root/record.log but that doesn't work either.
How can I force lame to output its messages to a log file?
Stickman, I understand the difference in the abbreviations but I was wondering why there are 2 types of output and how do you know the difference between the 2. Is the STOUT suposed to be for information and the STERR for error reporting? Is experimentation the only way to tell the difference?
I wonder if lame only uses STERR for it messages because it uses STOUT/STIN for compressed files.
It's really up to the author to determine what output goes in which direction. Theoretically, only output that from an error condition should go STERR. If it's not obvious what goes where, it may be in the man page for the program.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.