Bring prompt from a different process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bring prompt from a different process
# 1  
Old 06-15-2015
Bring prompt from a different process

Hi,

while running a program one of the command is creating a sub-shell which requires user inputs. Is there a way to bring the input prompt to a parallel session or an alternate way to input the values? the outer program doesn't allow to accept the parameter value for the command run in the sub shell.

Thanks!!
# 2  
Old 06-15-2015
There is no reason why a process running in a subshell can't read user input. But, a process running in the background can't. Only a foreground process can read from the controlling terminal for that process group.
# 3  
Old 06-15-2015
Hi Don,

It is indeed a foreground process which is being created be a program as another user which I need to bring it on to a prompt to be able to input the values. is there a way to bring the input prompt from a process that is already waiting for a process from one session to another?

Thanks,
Waseem
# 4  
Old 06-15-2015
I don't understand what you mean by bringing a process on to a prompt.

Maybe a concrete example showing what processes are running, what user IDs and group IDs were used when invoking those utilities, what prompts those processes are writing, and what input they are trying to read would help.
# 5  
Old 06-15-2015
sure. I am running a setup program as root. This starts a web GUI to get user inputs. Using the input user name from the webpage it starts a command as su.


Code:
1. setup command holds the screen and starts web interface(root) 
>> 2. In Web interface it asks for user name input
>> 3. Using user name input provided in the web page a new sh script(generated on fly) is executed which runs java command
>>4 this java command requires input from humans and it holds the processes and hangs forever.

I hope this provides the clarification!!
# 6  
Old 06-15-2015
I'm lost as well.

If you are running a script in a terminal emulator like xterm or lxterminal, you could open another terminal running your second program in parallel:
Code:
su -c "lxterminal -e ./yourscript"  newuser

---------- Post updated at 12:28 ---------- Previous update was at 12:24 ----------

Be aware that there are no automatically created data/information exchange channels between the processes. You'd need to use fifos or files.
# 7  
Old 06-15-2015
Ok, let me try to clarify again. Sorry for the confusion.

Here is a sample code

Code:
./wrapper.sh

within wrapper.sh
Code:
runuser -l username -c read -p "input a value" input

In the above example wrapper.sh is being triggered as root which in turn is running read command as another user waiting for input. can I have a parallel session logged in as "username" and get to input?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bring two files together

Dear Forum, I was wondering if anybody could help me to bring to files together. I have two text files. In the text file each record occupies two lines. First the ID number and in the next line text. $ cat text.txt +12345678 text_A +12345644 text_B +12334241 text_C +1234586... (5 Replies)
Discussion started by: GDC
5 Replies

2. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies

3. UNIX for Dummies Questions & Answers

How to Change the % prompt to - prompt in UNIX?

how to Change the % prompt to - prompt in unix :wall: ---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ---------- How To display the last modification time of any file in unix ---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM... (2 Replies)
Discussion started by: manjiri sawant
2 Replies

4. HP-UX

Adding Storage, do I need to bring the DB down?

Hi Guys, Do I need to bring the DB down? masd023x:: uname -r B.11.11 Thanks! Where can I find this type of information? JC (3 Replies)
Discussion started by: 300zxmuro
3 Replies

5. Red Hat

Cannot bring up Firefox

I have installed firefox and it previously worked before I installed the oracle software on my machine. Now when I click on the icon to bring up the browser it fails. I tried to do it from the command line and this is what I get: $ firefox Cannot find mozilla runtime directory. Exiting ... (1 Reply)
Discussion started by: jxh461
1 Replies

6. Solaris

Not able to bring up the server

Hi All, I have a iplanet server running on solaris , i'm not able to start it using the start Its giving following error root@bld00: /usr/iplanet/servers6.1sp8/https-MLL-8.3dev # ./start Sun ONE Web Server 6.1SP8 B06/13/2007 23:15 info: CORE5076: Using from info: WEB0100: Loading web... (2 Replies)
Discussion started by: renjithrnath
2 Replies

7. Solaris

Can't bring E25K system controller to OK prompt

Hi, Due to some changes at our company, we lost the password for the root and sms-svc account on the primary system controller (E25K). We connected a serial console to the system controller but we never managed to break the session to bring it to the OK prompt. (tried: ~#, ~ b, ~, , a b,... (9 Replies)
Discussion started by: Solarius
9 Replies

8. Shell Programming and Scripting

User Prompt during batch script process

The script below performs an incremental database backup. When the increment backup is out of sequence, the process prompts the user: "Incremental backup out of sequece. Do you wish to continue? Y or N". This script is set to run as a scheduled process in background mode. When the script... (2 Replies)
Discussion started by: bond007jlv
2 Replies

9. UNIX for Dummies Questions & Answers

Unable to bring up Sun OS

The last thing I did was set REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE. Then rebooted server. Since that time I have not been able to login. During bootup it can't find root and generates alot of errors. Does anybody know of a default login and password that will allow me to log in and rebuild the... (2 Replies)
Discussion started by: mayewil
2 Replies
Login or Register to Ask a Question