Drush "tput: No value for $TERM and no -T specified"

The drush script which provides comman line acceess to drupal functionality emits an error message when run as a cron job

tput: No value for $TERM and no -T specified

# If it is not exported determine and export the number of columns.
if [ -z $COLUMNS ]; then
  export COLUMNS=$(tput cols)
fi

I presume drush uses this information to calculate layout of output.

However when running as a cron job COLUMNS is not set and tput gives the above error.

To resolve this specify a COLUMNS value in your cron job, setting an appropriate size for viewing in email

cron now runs the following for me.

#!/bin/bash

cd /var/www/mysite/public_html

COLUMNS=80 /home/me/bin/drush cron

Tags

Comments

Thanks, having this problem

Thanks, having this problem too. Google lead me to this page when searching for the above error message ;)

Comments

Use of "export COLUMNS" in cron job

Thanks for this,

Just a small note, you can also edit your cron job instead of editing your scripts(which might be used elsewhere, not only in cron jobs and you don't want to mess with them), to do this use "export" for COLUMNS
example:

25 02 * * 2 COLUMNS=120 ; export COLUMNS ; bash /path/to/script.sh

Comments

Easier fix

Just adding a line:

COLUMNS=80

at the top of the crontab file works for me :)

Post new comment

Got something to add - just enter a comment
all other fields are optional.

Your email address will not be published.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image without spaces, also respect upper and lower case.