[Gllug] crontab

Tethys tet at accucard.com
Fri Jul 4 10:00:11 UTC 2003


Stig Brautaset writes:

>4,14,24,34,44,54 * * * * /usr/bin/fetchmail 2>&1 > /dev/null 

Nope. This will do the exact opposite of what you want. Because
redirections are parsed in strict left to right order, you're
redirecting stderr to the same place as stdout, and only later
changing where stdout goes (which doesn't affect what you've
already done with output stream 2 -- stderr). There seems to be
a lot of confusion about the >& syntax. It doesn't tie the two
streams together, it merely one to the current value of another.
Think of it like variable assignments:

	stream2 = steam1;
	stream1 = something_else;

This is different to:

	stream1 = something_else;
	stream2 = stream1;

Try it:

	mv foo 2>&1 >/dev/null

will still output the error message to the screen.

>[1] certainly sh-type -- don't know for csh etc.

What csh does doesn't really matter. Cron will always use /bin/sh,
unless you explicitly override it in the crontab, and no one in
their right mind would do that...

Tet

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list