Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a CRONTAB entry as below. Can someone tell me what the below statement is exactly doing?

1 0 * * * /vol01/sites/provisioning/MNMS/45627/45627.sh1 >> /vol01/sites/provisioning/MNMS/45627/output/cron.log 2>&1
share|improve this question

marked as duplicate by slm, Anthon, rahmu, jasonwryan, Gilles Sep 4 '13 at 22:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
    
@mana ....thanks a lot very useful articles.. –  user3475 Sep 5 '13 at 4:02

2 Answers 2

up vote 1 down vote accepted

> redirects output to a file, overwriting the file.

>> redirects output to a file appending the redirected output at the end.

Standard output is represented in bash with number 1 and standard error is represented with number 2. They are separate, so the user can redirect them to different files.

2>&1 redirects the standard error to the standard output so they appear together and can be jointly redirected to a file. (Writing just 2>1 would redirect the standard error to a file called "1", not to standard output.)

In your case, you have a job whose output (both standard and error) is appended at the end of a log file (cron.log) for later use.

For additional info, check the bash manual (section "Redirection"), this question, and this question.

share|improve this answer

You should google with keyword bash redirection for some detailed information. Here is a nice article for reference.

For your question, the crontab will run 45627.sh1 scripts at 00:01 everyday and append its error and output to the cron.log file.

share|improve this answer
    
Thanks a lot. It really helps. Now I understood Google can't give everything. Experts advice always best :) –  user3475 Sep 4 '13 at 12:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.