send y /n to a procces after itīs running


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting send y /n to a procces after itīs running
# 1  
Old 06-11-2008
send y /n to a procces after itīs running

Hello

Iīm a senior Unix technician, i have a problem: I need send "y" and "enter" to a proccess that are running in memory. I explain that.

I have a server with Suse 10.3 that itīs runnig informix 11.10, this server are a backup server of a database server, to ensure the integrity of data y need execute a command "ontape -l" this command is interactive, and ask you to send a "yes enter" when you change the backup tape.

Mi problem is that command can interrup, because itīs change the state of database when itīs aborted, well i need make script to execute dayli that send "yes enter" to this proccess.

I try redirectin standard input, but this itīs only valid for one execution, example:

temp.txt
[status printer1
stop printer 2
]

serverBD:/DATA/LOGS # lpc < kk.txt
lpc> hpmater1:
printer is on device 'socket' speed -1
queuing is enabled
printing is enabled
no entries
daemon present
lpc> hpmater11:
printer is on device 'socket' speed -1
queuing is enabled
printing is enabled
no entries
daemon present

but this solution not solve my problem because, i need lpc running always

I try with jobs, making invoke call similar to:

echo "y \n"|fg pid

but Iīm not capable to make it works

anyone have a idea?, how i can send "y n" to a proccess that have standar input in shell and can not be aborted never.

Very very thanks.
# 2  
Old 06-11-2008
Maybe you can try to pipe the output of the yes command to your program, something like:

Code:
yes | yourprogram

# 3  
Old 06-13-2008
thanks, but this not work, because yes send y continuisly, and I need only pass yes when I decide.

Today have found a solution, not for this, but i discoverd that ontpa -l can be used in this form ontape -l -C an this command not change the state of database, with this my problem is rosolved y can invoke ontape -l -C when i need.

Thanks for all
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Need to send mail only when the job is not running

I have set up a cron, which will send the mail with not runnnig jobs in the script.sh 15,30,45 * * * * /a/b/c/script.sh | grep not | mail -s "test mail" learner987@gmail.com But i dont want mail when all the jobs are running, but with the above cron i will get mails without the content(if all... (2 Replies)
Discussion started by: learner987
2 Replies

2. UNIX for Beginners Questions & Answers

Grep the 'not running' jobs and will send the update in mail with its name(job)

my request is: i have to create a script , which will grep the 'not running' jobs and will send the update in mail with its name(job) Scenario: logged in to machine abc went to particular path: cd /a/b/c then ./script1.sh status (script.sh is a script,whose status gives info about 10 jobs... (1 Reply)
Discussion started by: learner987
1 Replies

3. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

4. AIX

Able to send mail without running MTA (sendmail)?

Hi, I am facing a (for me and coworkers) strange behaviour. When I stop sendmail on a plain AIX 5.3 testing box (there is definetly no sendmail process left running anymore), I am still able to send mails to remote addresses via the mail command. I tried that on another box which is not a... (6 Replies)
Discussion started by: zaxxon
6 Replies

5. Shell Programming and Scripting

Running Total Running Wild

Hi. A shell scripting newbie here. I am trying to write a script that will create a running total of Sales, and increment a counter for each Sales entry, but when I executed the program it never stopped. counter=0 Sales=0 echo "enter sales price" read sales while do let counter=counter+1... (6 Replies)
Discussion started by: Ccccc
6 Replies

6. UNIX for Advanced & Expert Users

send attachments using send mail in Solaris

Hi All, I have a requirement to send and email of body html with an attachment. concatinating uuencode output to the mail body with mailx command works, but as my Email body is of HTML type i use sendmail. my command to send HTML body is as below: export MAILTO="recipient@domain.com"... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

7. UNIX for Advanced & Expert Users

send a new value to a variable in a running background process

Hi guys, I have a issue with a background process, I need to update the value of a variable in that process which is running at this time and it will be running for at least 2 days. Any idea? I will apreciate your help. regards. Razziel. (2 Replies)
Discussion started by: razziel
2 Replies

8. Shell Programming and Scripting

Is there a way to ask expect wait for sometime before running the next send command ?

Hi all, After expect catches the string I specify, is there a way to ask expect wait for sometime before running the next send command ? So my script looks like following, expect "some string" #How to ask expect to wait for a while send "next command" The reason I want to do this is... (0 Replies)
Discussion started by: qiulang
0 Replies

9. Shell Programming and Scripting

send mail after script finishes running

Hi All, We now have a Log file which has time stamps of all the scripts ran. It has start time and end time. I now have a requirement to send mail to the Admin after the script finishes running. Can some one help me with a Script which will send mail with Start time and End time of the... (2 Replies)
Discussion started by: srikanthgr1
2 Replies

10. UNIX for Advanced & Expert Users

How to prevent job1 from running while job2 is running..

Hi, Please I need your expert advise on how to prevent/lock from execution job1 while job2 is still running in Unix... THanks:) (3 Replies)
Discussion started by: tikang
3 Replies
Login or Register to Ask a Question