- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting issue where it wants a tty
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 08:47 AM
03-06-2002 08:47 AM
Scripting issue where it wants a tty
Example:
MY_tool <
ENDTHIS
I get the error, "Not a tty."
I keep thinking there may be another shell or perl method to trick the "MY_tool" program into thinking I'm really on a tty. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 09:47 AM
03-06-2002 09:47 AM
Re: Scripting issue where it wants a tty
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xcfb23fa720f3d5118ff40090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x27ed5f260cafd4118fef0090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2697e7613948d5118fef0090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x73e66c96588ad4118fef0090279cd0f9,00.html
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 09:59 AM
03-06-2002 09:59 AM
Re: Scripting issue where it wants a tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 10:22 AM
03-06-2002 10:22 AM
Re: Scripting issue where it wants a tty
Could it be that a .cshrc or .kshrc file executes a set command or similar.
You need an "if" clause in this script to avoid execution when run from cron.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 10:24 AM
03-06-2002 10:24 AM
Re: Scripting issue where it wants a tty
Myself not being a friend of Tcl, I would rather go for the Perl port of Expect.
You can get it (as all Perl goodies) from CPAN.
http://cpan.valueclick.com/modules/by-module/Expect/
In the readme above you will also find the URL of the Tcl original.
HTH
Ralph
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 10:43 AM
03-06-2002 10:43 AM
Re: Scripting issue where it wants a tty
As stated earlier, you need validation routines like an if statement:
if [ "`tty 2>&1`" = "not a tty" ]; then
print "This is run from cron or ssh or whatever"
else
print "You are running from a tty"
fi
HOpe this helps !
-Shabu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 12:04 PM
03-06-2002 12:04 PM
Re: Scripting issue where it wants a tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2002 08:57 PM
03-06-2002 08:57 PM
Re: Scripting issue where it wants a tty
I actually don't think this is a problem. Obviously in the script that gets called there is a command in there to run a "tty" or something like that. A tty command will give an error "not a tty" if run in the way you are describing, but it will not halt the script. The only problem I can see is if it tries to capture the output of the tty command to an environment variable and then examine this environment variable. This is because the environment variable will now say something like "not a tty" instead of something like "/dev/pts/34". If the script does this, then it needs to be modified to handle the fact that it isn't a tty. But if it doesn't do this, then I don't think it's going to cause a problem to the correct execution of the script. A bit game, I know.
For example, many .profiles use various tty commands. if yours does, then run the following and see what happens:
echo "" | . ./.profile
you will see that you get an error saying:
stty: : Not a typewriter
or
not a tty
but the .profile script still finishes okay.
Hope this helps.
- Andy Gray
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 06:54 AM
03-07-2002 06:54 AM
Re: Scripting issue where it wants a tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 07:14 AM
03-07-2002 07:14 AM
Re: Scripting issue where it wants a tty
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 08:41 AM
03-07-2002 08:41 AM
Re: Scripting issue where it wants a tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 09:23 AM
03-07-2002 09:23 AM
Re: Scripting issue where it wants a tty
Example:
My_tool <
logoff user=myuser
ENDIT
Still get the no tty error wherever I direct the output.
Seems to me I need to trick the input somehow so it thinks I'm on a tty or /dev/console, etc, but I'm not sure if that's possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 09:54 AM
03-07-2002 09:54 AM
Re: Scripting issue where it wants a tty
My_tool <
logoff user=myuser >/dev/tty 2>&1
ENDIT
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 10:33 AM
03-07-2002 10:33 AM
Re: Scripting issue where it wants a tty
Lateral thinking
Run a cronjob on another server to telnet to the server with the script - login and fire up the script and when finished leave.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 12:11 PM
03-07-2002 12:11 PM
Re: Scripting issue where it wants a tty
Paula, thanks. Your idea was was my final option, which should work. In fact, I could even use the cron on the server itself to use expect and then telnet back to itself. I don't really like this idea because I'd have to put the password in the script and its very unelegant. But it should work and if I really need to automate this, its probably my only choice left. When I get the time to install TCL/TK/expect I'll give this a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 02:01 PM
03-07-2002 02:01 PM
Re: Scripting issue where it wants a tty
If it's a shell script, it may be possible to circumvent the tty restriction without actually providing a tty and without modifying the script. Examine the script and look for the use of the commands tty or pty.
If it's a POSIX shell script, then it may check like this:
tty || exit
if tty -s
then
continue()
else
echo "Not a tty"
fi
if ! tty -s
then
echo "Not a tty"
exit
fi
if [ -t 0 ]
then
echo "You are out of luck here"
exit
fi
If it is using tty or pty, alias them to true or false (whichever is appropriate) before sourcing the script:
alias tty=true
. script <
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2002 02:14 PM
03-07-2002 02:14 PM
Re: Scripting issue where it wants a tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 08:02 AM
03-08-2002 08:02 AM
Re: Scripting issue where it wants a tty
just a thought,
mark
btw, which vendor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:16 AM
03-08-2002 09:16 AM
Re: Scripting issue where it wants a tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 09:25 AM
03-08-2002 09:25 AM
Re: Scripting issue where it wants a tty
After reading all this, I can see two options:
Plan A: Relatively easy but messy (and you've already mentioned it) Loop output from one tty port to another.
Plan B: Elegent but technically difficult. Write and install a pseudo-tty device driver so that the isatty(0) function returns 0 and thus the application thinks stdin is a tty device (because it is). The idea is that your can write to this pseudo device and store your input and then the read read from the buffer.
I did have to do something very much like this many years ago but I haven't done it in the HP-UX world.
Food for thought, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 10:06 AM
03-08-2002 10:06 AM
Re: Scripting issue where it wants a tty
Oops, I'm stupid, I meant to say so that isatty(0) returns a non-0 result.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 11:24 AM
03-08-2002 11:24 AM
Re: Scripting issue where it wants a tty
I dont like to use /dev/console ( it could interact with syslogd). But i had do it some times using /dev/tty0p1 or similars.
New tecnichs is the use of a x-terminal device instead. You can open a window and just redirect to that /dev/... pts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 11:55 AM
03-08-2002 11:55 AM
Re: Scripting issue where it wants a tty
"it is a 3rd party binary".
Well I would expect a real binary to speak clearly to me if something is wrong, if it is well coded.
Conclusion: The message does NOT come from the program, but the program calls an operatingsystem-command via c-call "system" or so (stty, tset ....)
If you are lucky, "strings programname" gives you a clue what it is calling. May be you can patch this name with a hexeditor to call a program of yours, that does what the program needs, but fakes the tty flags....
No idea if this helps.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2002 12:16 PM
03-08-2002 12:16 PM
Re: Scripting issue where it wants a tty
Volker: "if it is well coded". That's a good one. The code needs help which the vendor admitted. strings actually shows that "Not a tty" is inside the binary, that means they're doing their own checking. I see no external calls to other programs either.
Clay, you're on the right track. I don't have time or patience for plan B. I have gotten this to work using expect. I have to make my code much more complex for my issue, but this is probably the route I'll take. Thank you all for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2002 12:00 AM
03-11-2002 12:00 AM
Re: Scripting issue where it wants a tty
Standard files:
standard-input file_despcriptor 0
standard-output file_despcriptor 1
standard-error file_despcriptor 2
my_program 0/dev/tty0p1 2>&1