APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

running script in background active tty

© December 2004 (various authors)

What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):

From: "Brian K. White" <linut@squonk.net>
Newsgroups: comp.unix.sco.misc
Subject: Re: Cant run program in background
Date: Tue, 03 Oct 2000 18:55:58 -0400
Message-ID: <39DA63FE.F407DDF5@squonk.net> 
References: <adsC5.870$R04.94949@news1.primary.net> 
Cache-Post-Path: firth.squonk.net!unknown@dialup-117.squonk.net

Fabio Giannotti wrote:
> On 5.0.5, I have a ELF 32-bit LSB executable (tin) that seems to not want to
> work unless it is on an active tty.
> If I try to run the program in the background (using &), I get:
>   select() failed: Error: Invalid arguement
> Is there a way to "fool" it into thinking it is on an active tty?
> (Ultimately, I want to run this in cron.)
> Thanks in advance,
> Fabio

*maybe* with expect (see skunkware)
maybe with nohup (standard command)

and/or maybe by simply redirecting one or more of fd's 0, 1, and 2.
explanation: maybe when a program goes into the background it just closes  0
(stdin), 1(stdout), and 2 (errout) and so you can't call select() on
nothing. so maybe if you supply someting for select() to act on that will be
good enough. so perhaps just tuoch a couple files progin, progout and run
with  prog 0<progin >progout 2>&1

or perhaps use an existing but always unused tty
disable tty06
prog </dev/tty06 >/dev/tty06 2>/dev/tty06
(I just tried this with a simple "more" command and it didn't quite work as
I'd hoped. it displayed the output on tty06, but didn't accept any
keystrokes from tty06 or anywhere else, had to kill -HUP the process. but
something like this might still get you program to run if you don't need to
send it any keystrokes anyways. or you could store the input in a regular
file and do  prog <file >/dev/tty06 2>&1

I think linux has a command for running a program on a particular tty
instead of the current one, something like "vcopen" , anyone know of a sco

Brian K. White                   https://www.squonk.net/users/linut
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> running script in background active tty ––>Re: Cant runprogram in background

Inexpensive and informative Apple related e-books:

Take Control of IOS 11

Photos for Mac: A Take Control Crash Course

Take Control of Upgrading to El Capitan

iOS 10: A Take Control Crash Course

Sierra: A Take Control Crash Course

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Any teacher that can be replaced with a computer, deserves to be (David Thornburg)

Linux posts

Troubleshooting posts

This post tagged:


Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode

SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)