First, I'm sorry if this is the wrong stackexchange for this, but it seemed like the right one.

This is my crontab right now:

MAILTO=****@gmail.com
10,30,50 * * * * ~/webapps/****/apache2/bin/start
*/10 * * * * /usr/local/bin/python2.7 ~/webapps/****/WR/cron.py > ~/webapps/****/WR/cron.log 2>&1

But every time the output is placed into the cron.log file, all the old content gets overridden. How do I stop that? Or, if it's not possible, what's an alternative?

Note: The **** in the URL and email are there to hide personal information.

up vote 30 down vote accepted

Swap > for >>.

>  = write to file, overwriting what was already there
>> = append to file, create if it doesn't exist

i.e.:

MAILTO=****@gmail.com
10,30,50 * * * * ~/webapps/****/apache2/bin/start
*/10 * * * * /usr/local/bin/python2.7 ~/webapps/****/WR/cron.py >> ~/webapps/****/WR/cron.log 2>&1
  • Where are you getting all this formatting information from? My webhost's cPanel has like 0 formatting information posted for crontab commands. Only the >/dev/null 2>&1 trick. – Jon Grah Jan 18 at 6:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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