Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell program / Wrapper Needed to gracefully shutdown the session 1

Status
Not open for further replies.

vg2511

IS-IT--Management
Dec 17, 2005
16
US
I have been working on tuxedo for the past two months, and there we have this queue admin utility called qmadmin, which if it recieves a signal 9 , 15 ,1,2,6...( when it is open )it makes the qmadmin hung up and no processing of the queue is carried out.
From a Unix perspective when I asked one of the system admin , he told me the following :
"Basically run a C wrapper (or shell???) program around the qmadmin command that catches any shell disconnect/kill signal...then within that function it shud disconnect/exit the qmadmin session gracefully."

As I am very limited on C , what are the options open to me to actually make this happen through a shell script.
We have to do a quit in the qmadmin utility to gracefully shut it down.
If trap , then how to make a wrapper with use of trap command and how to send a quit to the semi-hung qmadmin command in order to gracefully shut it down.

Thanks to all nice samaritans.
 
Basically, I want to trap the signals (9,15)on the qmadmin command and make it quit gracefully.
 
How do you normally send a trap to the qmadmin command?

I think something along these lines might do the trick, however I believe that if the signals are sent directly to the qmadmin process rather than the shell process there is little you can do about it.

Code:
#!/bin/ksh

function quitqmadmin {
    # insert commands to shut down qmadmin here
    exit
}

trap quitqmadmin 1 2 6 9 15

# insert commands to start qmadmin here

wait

Annihilannic.
 
Thanks for the input, I have more info on this :
When I do a truss qmadmin , the following is the output when I key in q ( for quit ) :

truss qmadmin

....

read(0, " q\n", 1024) = 2
_exit(0)

When I did a man kill , I found this info :

exit_status
A decimal integer specifying a signal number or
the exit status of a process terminated by a signal.

Can any of the stuff that is there in "truss qmadmin" be passed thru to kill ( or any other means ) that it gracefully shuts down the process.

Thanks.
 
My feeling is that the only way you can reliably solve this problem is by modifying the qmadmin source code, which I presume you can't do? I'd report it to the software vendor as a bug and hope that they can provide a solution.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top