Summary: | crontab task fail to work if stdout redirected | ||
---|---|---|---|
Product: | Base System | Reporter: | Dmitry Cheshkov <dcheshkov> |
Component: | conf | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | New --- | ||
Severity: | Affects Only Me | CC: | admin, chris |
Priority: | --- | ||
Version: | 13.1-STABLE | ||
Hardware: | amd64 | ||
OS: | Any |
Description
Dmitry Cheshkov
2022-07-01 12:24:01 UTC
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 |