24

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.

1 Answer 1

49

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
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, 2018 at 6:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .