Operating System - HP-UX
1843977 Members
1631 Online
110226 Solutions
New Discussion

Setting TERM variable in Script to run from CRON

 
SOLVED
Go to solution
Garrin Thompson
Advisor

Setting TERM variable in Script to run from CRON

We have the need to setup some environment variables in a script that ultimately executes a cobol program and is scheduled by CRON. When it gets to where it runs the cobol progran, I get the error "Terminal type not defined". We copied the following from the root .profile and put it at the top of the script, but now we're getting the error "not a terminal":
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
export TERM

How can we do this? Cobol apparently needs TERM set, but we need to run this from CRON.

Help!?!?!
2 Years old on HP-UX 10.20 R9000 server
2 REPLIES 2
John Palmer
Honored Contributor
Solution

Re: Setting TERM variable in Script to run from CRON

The 'not a terminal' message is from 'stty'.

You don't want to run 'stty' or 'tset' from cron because they require a real terminal to be connected.

If your application requires TERM then simply export the require value e.g.

export TERM=vt220

Garrin Thompson
Advisor

Re: Setting TERM variable in Script to run from CRON

Surely it can't that easy?!? :-)

I'm glad I have this forum...Thank you all!
2 Years old on HP-UX 10.20 R9000 server