Operating System - HP-UX
1754964 Members
2560 Online
108828 Solutions
New Discussion юеВ

Re: shell script challenge regarding background/prompt/pipe

 
SOLVED
Go to solution
Graham Cameron_1
Honored Contributor

Re: shell script challenge regarding background/prompt/pipe

Suspect your program does a close(0) and then opens another fd for reading.

Unless you know which fd this is, or have the patience to keep trying

nohup EXECUTABLE 3nohup EXECUTABLE 4
etc up to 20,

then I'd give up if I were you...

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
BIHAN
Frequent Advisor

Re: shell script challenge regarding background/prompt/pipe


mkfifo fifo
nohup EXECUTABLE echo "^M" >fifo
BIHAN
Frequent Advisor

Re: shell script challenge regarding background/prompt/pipe

missing an & at the end of the nohup line

i think
echo > fifo
would be better than
echo "^M" >fifo
James Lynch
Valued Contributor

Re: shell script challenge regarding background/prompt/pipe

Kevin,

How about posting this script so that we can have a look at it?

JL
Wild turkey surprise? I love wild turkey surprise!
Kevin_31
Regular Advisor

Re: shell script challenge regarding background/prompt/pipe

The real issue is the EXECUTABLE, which is part of Oracle Applications 11i Server, and is over 6 megabytes in size. Probably not the best idea to post (I expect it wouldn't run without the other bits of code that make up the Oracle installation.

Thanks everyone, but I think I'll just have to use cron to restart this bit and keep it out of Omniback post-exec alltogether.

cheers
Mark Ellzey
Valued Contributor
Solution

Re: shell script challenge regarding background/prompt/pipe

Kevin,

If you are just trying to answer a prompt that the application requires, and it's a carriage return, I've done it as such:
echo "\013" | APPLICATION > /dev/null 2>&1 &

This works for me in a script that runs an Informix backup procedure, which is normally interactive.

Regards,
Mark
Kevin_31
Regular Advisor

Re: shell script challenge regarding background/prompt/pipe

Amazing, I've tried every suggestion listed above, and the last one... finally... worked!

cheers Mark!

(I can always count on ITRC Geniuses)
Todd McDaniel_1
Honored Contributor

Re: shell script challenge regarding background/prompt/pipe

No points here...

I just want to say I enjoyed reading this puzzle...

We need more posts like this to test our brains power.

I personally troll the boards to educate myself... and posts like this are helping.
Unix, the other white meat.
Ulrich Deiters
Frequent Advisor

Re: shell script challenge regarding background/prompt/pipe

... sorry to be late due to my timezone! A useful trick to communicate with a background process works like this:

1st: You start the background job:
bgjob 2>&1 1>logfile |&

2nd: You retrieve the background job's stderr output (error messages, prompts, etc.):
read -p $bg_output

3rd: You send data to the background job's stdin:
bg_input="some_input"
print -p -R $bg_input

This works with POSIX-compatible shells, e.g., /usr/bin/sh and /usr/bin/ksh, but not with bash.

I hope this is useful for you.