Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: TERM environment variable not set - SOLVED

_____/ On Wednesday 24 August 2005 12:12, [ERACC] wrote : \_____

> On Wed, 24 Aug 2005 06:17:22 +0100, Roy Schestowitz wrote:
> 
>> I am trying to access usage stats remotely, so every 10 minutes the
>> following gets executed:
>> 
>> top -b -n 1 >> ~/public_html/caption.txt
>> 
>> The cron job comes up with the following error:
>> 
>> "TERM environment variable not set."
>> 
>> When I run the command as myself, there appears to be no problem. Any
>> ideas?
>> 
>> Thanks,
>> Roy
> 
> Try:
> 
>  TERM=linux
>  export TERM
>  top -b -n 1 >> ~/public_html/caption.txt


YES! Thank you. You got it right the first time:

http://baine.smb.man.ac.uk:8001/caption.txt

This seems similar to the way I got around grabbing a screenshot as cron,
namely:

export DISPLAY=localhost:0.0


> OR try:
> 
>  #!/bin/bash
>  top -b -n 1 >> ~/public_html/caption.txt
> 
> OR try:
> 
>  #!/bin/bash
>  TERM=linux
>  top -b -n 1 >> ~/public_html/caption.txt
> 
> ... in your script that gets run by cron. IIRC using the /bin/bash
> route uses whatever bash has as a default TERM. Not certain of that
> though thus the third example. The top program needs to know the
> TERM(inal) used so it can format the output.
> 
> One or the other should work to set your TERM variable to something
> useable by cron.


This is where you are far ahead of me. *smile*


> BTW, you really want to APPEND '>>' to that file forever? I forsee it
> getting rather large after a week or more of use.


To put it in context:

http://www.schestowitz.com/Utilities/Complete/Linux/Display_Grabber/

I am still working on that page, which is not public yet.


> Also the '~' will
> not expand to YOUR home directory when the job runs under cron so
> replace that with the full path to whatever directory you want to use
> to store the file. Like /home/roy/public_html/caption.txt for
> example.
> 
> Gene (e-mail: gene \a\t eracc \d\o\t com)


Good point. I might change the path, locally at least.

Many thanks!

Roy

-- 
Roy S. Schestowitz        "Slashdot is standard-compliant... in Japan"
http://Schestowitz.com

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index