freebsd cron envidonment variable COLUMNS

Today another strange issue – involving a cronjob on freebsd 8.1 which delivers different results when run from the console:

I’m running
ps aux
from the console and I get the expected results.

I’m running the same thing from the crontab – the lines are cut/truncated.

The solution was to specify the COLUMNS-environment variable…

This can be done by writing
COLUMNS=250 at the top of the crontab, or by prepending the command to be executed like this

*/10 * * * * COLUMNS=250 /path/to/my/script.sh

Leave a Reply

Your email address will not be published. Required fields are marked *