Score:1

Redirecting stdout and stderr doesn't work with cron

br flag

I have the following cron task. Expected behavior is that every output (standard output and standard error output) of this task will be redirected to /dev/null. Unfortunately this doesn't work. Emails with errors are still sent.

7-57/10 * * * * wget -O - https://some.url.com/path/file.php?key=somerandomkey&folder=dwg >/dev/null 2>&1
Andrew Henle avatar
ph flag
What exact Linux distribution/version are you running?
XorOrNor avatar
br flag
@Andrew Henle it's Rocky Linux 8.7
AnFi avatar
fi flag
Put URL (with &) in quotes -`'wget -O - https://some.url.com/path/file.php?key=somerandomkey&folder=dwg'`. Shell may interpret & as end of command to run in background.
Score:0
in flag

If you do not want to receive mails from cron set as first line (in cron) this:

MAILTO=""

And better create a script with the command and then do the redirect.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.