[mythtv-users] Can't send mythfilldatabase output to /dev/null

Ian Campbell ijc at hellion.org.uk
Fri Dec 24 11:55:39 UTC 2004

On Fri, 2004-12-24 at 07:29 +0000, Stroller wrote:
> On Dec 24, 2004, at 5:33 am, Phill Edwards wrote:
> > When I run this command, all the output should go to /dev/null, I 
> > believe:
> >
> > $ mythfilldatabase --file 1 7 /home/mythtv/.xmltv/tvlistings.xml 2>&1
> >> /dev/null
> >
> > However, the output goes to screen, or to mail when I run it from
> > cron...
> It's been a while since I looked at the syntax for this sorta stuff, 
> but in my cron I have a number of entries in the format:
>     /usr/bin/fetchmail  > /dev/null 2>&1
> which seem to do what you require.

That's correct, the order of the redirections matters

If you have a process with fd1->stdout and fd2->stderr then the first
command line gives you, (> is the same as 1>):
	2>&1 		fd1->stdout, fd2->stdout
	1>/dev/null	fd1->/dev/null, fd2->stdout
which isn't what you want. Instead if you do
	1>/dev/null	fd1->/dev/null, fd2->stderr
	2>&1		fd1->/dev/null, fd2->/dev/null
then you get what you want. Instead of thinking too hard about it I
often just use "1>/dev/null 2>/dev/null" if that is what I want.


Ian Campbell

Oh, I've seen copies [of Linux Journal] around the terminal room at The Labs.
	-- Dennis Ritchie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20041224/068733d8/attachment.pgp

More information about the mythtv-users mailing list