Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to save my crontab output:

15 * * * * > ~/logs/log1.txt

How do i make the crontab save to a new file everytime (i.e. log2.txt, log3.txt etc.) , instead of updating or overwriting the old one?

Perhaps there's a utility i could use to do this?

I'm using CENT OS 5.

Thanks ;)

share|improve this question
Have a look at unix.stackexchange. – binfalse Apr 26 '11 at 11:08

You could use the date and time to make a unique file name

15 * * * * > ~/logs/log.$(/bin/date +\%Y\%m\%d\%H\%M\%S).txt

This will create files named like ~/logs/log.20110426121501.txt

share|improve this answer
if you can't use the date as answered by Iain
from your script output a watermark like ### 
this is what I have into test.txt


then to process it 
shell$ awk -F "###"  {'print $1'} test.txt



i have the delimiter changed from ' ' into awk to '###' and then just print the lines
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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