Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Meaning of 2>&1 in crontab

Answer:

It is quite common to find the following line in crontab

32 5 * * * root /project/cron.sh >> /dev/null 2>&1

The meaning of 2>&1 at the end of line means to redirect the standard error stream (stderr) to the standard out stream (stdout), and finally redirect everything to /dev/null.

It is commonly used in crontab definition so if a given command return too much warnings, it will not be logged anywhere in the system in order to reduce the storage requirements.

  1. Send the crontab result to email
  2. What does the run-parts mean in crontab?
  3. Ignoring the program’s output
  4. How to redirect error message to a file
  5. How to redirect output to a file

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>