Can someone explain to me what is the meaning of "2>&1" doing here in the below cron job
0 23 * * * wget -q -O /dev/null "https://example.com/index.php" > /dev/null 2>&1
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
It means that
2 - containing error messages from the executed command or script) is redirected (
1 - the output of the command) and that the latter is being redirected to
/dev/null (the null device).
This way you can suppress all messages that might be issued by the executed command. In cron this is often done to avoid being spammed by lots of irrelevant messages from service scripts. Nevertheless be careful with this as some messages might be important.