The following periodic task fail to work if stdout/stderr redirection appended. */5 * * * * /bin/date | /usr/local/bin/test2 > & /dev/null - not work, but */5 * * * * /bin/date | /usr/local/bin/test2 works well. And /bin/date | /usr/local/bin/test2 > /dev/null 2>&1 resulted in 'Ambiguous output redirect'. /usr/local/bin/test2 - just short perl script: #!/usr/local/bin/perl open(OUT, ">>/var/log/test.log"); print OUT <STDIN>; close(OUT); exit(0); So, how make periodic tasks like this to work? This issue arose after migration from 12.3-STABE to 13.1-STABLE. Whith best regards, Dmitry Cheshkov
The following works in cron: ``` 0 0 * * * command > /dev/null 2>&1 0 0 * * * ( command1 | command2 ) > /dev/null 2>&1 ```
Actually, problem arose with mrtg script. in 12.3-stable the following line in the root crontab worked fine */5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg > /dev/null 2>&1 but in 13.1-stable does not. Removing of '> /dev/null 2>&1' makes mrtg working. Also, I found, that addition of 'env LANG=C' before '/usr/local/bin/mrtg' makes mrtg working with stdout+stderr redirection to /dev/null in 13.1-stable: */5 * * * * env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg > /dev/null 2>&1