Running Ubuntu 16.04 I have added the following to /etc/crontab:* * * * * root wget https://www.exmaple.org/bus/ >/dev/null 2>&1The cron job runs properly, but the result is written as a file to /root/ rather than being discarded as expected. Being a Linux newbie, I presume I am missing something elementary, but a fair bit of searching hasn't turned up anything that seems germane.
Why might >/dev/null 2>&1 not work?
cron;io redirection;wget
>/dev/null discards the standard output of the command. There is none in your example. 2>&1 causes the standard error of the command to be discarded. In your example, this contains status and error information displayed by wget.If the URL is valid (as in, if the server returns some content for the page), wget saves the content of the page in a file. This is neither displayed wget's standard output nor wget's standard error: it's some data that wget saves in a file. This is not affected by redirections, since wget is outputting to a file that it opens by name, not to a standard stream.If you don't want to save the output anywhere, tell wget to save it to /dev/null:wget -O /dev/null Note that errors from a cron job are useful to have, but Ubuntu discards them by default. The output of a cron job (standard output and standard error) is sent by local mail; see How are administrators supposed to read root's mail? for how to make that work. Annoyingly, wget produces a lot of output even when everything is working fine, it has no option to display only errors. You can work around this by saving the output and discarding it if the command is successful:trace=$(wget  2>&1) || echo $trace >&2