Author |
Message
|
learnmqnow |
Posted: Thu Oct 27, 2005 3:55 am Post subject: Solved!!! runmqtrm as background process in Linux |
|
|
Novice
Joined: 04 Oct 2005 Posts: 13 Location: Bangalore, India
|
Hi,
I'm having a problem with running trigger as background process. I have a shell script file containing the path and classpath setting commands and the runmqtrm command. when i execute this script, trigger is running as a foreground process. I read that to make it a background process, i should give '&' in the environment field. I did that and then I killed all the running triggers. Now, when i send messages to queue, its not triggering. The application should be triggered from a particular folder only. how will i do this as background process?
Thanks .
Last edited by learnmqnow on Thu Nov 03, 2005 2:03 am; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Oct 27, 2005 4:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You probably want to start troubleshooting this by doing something to capture the output of runmqtrm when it's running in the background - like using output redirection or nohup or etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Oct 27, 2005 4:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 27, 2005 12:44 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
|
Back to top |
|
 |
learnmqnow |
Posted: Thu Oct 27, 2005 8:26 pm Post subject: |
|
|
Novice
Joined: 04 Oct 2005 Posts: 13 Location: Bangalore, India
|
Hi,
I went throught the links u gave..but my trigger monitor works fine when run from a shell script in the terminal. The prob is i have 16 triggers and i dont want the 16 terminals open in the screen. I am writing the output of the program to a log file.
I simply added an & to envrdata to make it a background process . when i gave ps -ef | grep runmqtrm, i got the previously running triggers and i terminated it. now no trigger processes are running except the default runmqtrm. Do i have to start the monitor and do a CTRL+Z? or if i give the & it is supposed to start automatically??
Now when i send a message, no triggering is happening,message still lies in the queue, but if i start the trigger from the terminal, it immediately triggers..
I think am missing some step to make the trigger monitor as a background process.
pls explain how it happens..
thanks. |
|
Back to top |
|
 |
raja_no_1 |
Posted: Fri Oct 28, 2005 2:16 am Post subject: |
|
|
 Apprentice
Joined: 05 Sep 2005 Posts: 34
|
Try runnning the process using nohup command of unix instead of &. It shud do the trick.
e.g
inside test.sh
----
nohup <process name to start>
---- |
|
Back to top |
|
 |
wschutz |
Posted: Fri Oct 28, 2005 2:22 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Also, if you are running MQ V6, you can have the queue manager automatically start a trigger monitor by defining a SERVICE object. _________________ -wayne |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 28, 2005 4:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Run your trigger monitor with nohup, not your script.
Then confirm that triggers do or do not get processed - even if your app doesn't work.
Nohup will write the output from the process into a file that you can read, usually called "nohup.out" in the working directory. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 28, 2005 9:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
When you run the trigger monitor as a foreground process does the application get triggered, run, AND terminate cleanly ?
 |
|
Back to top |
|
 |
learnmqnow |
Posted: Sun Oct 30, 2005 9:33 pm Post subject: |
|
|
Novice
Joined: 04 Oct 2005 Posts: 13 Location: Bangalore, India
|
hi,
i tried with nohup also. I'll explain in detail what i did.
I hv de queues OT.DP.LQ and OT.DP.IQ. The process defn is OT.DP.PRC.
The application id for process defn is 'java com/ot/mw/ReadEOD' which i modified as 'nohup java com/ot/mw/ReadEOD'. Environment data has an &.
I have a directory say /opt/mqm/Trigger, in which i have a shellscript file which contains the following commands.
export PATH=/opt/java/bin
export CLASSPATH=/opt/mqm/Trigger
runmqtrm -m OT.MW.MGR.QM -q OT.DP.IQ
When i run the command ./startup.sh from the terminal /opt/mqm/Trigger,
the trigger gets executed and the application finishes cleanly. When i added nohup also, all the print statements are written to nohup.out file.
But once i do a CTRL+Z and stop the trigger, the new message that i am putting is not triggering at all. The message simply lies in the queue. If i give runmqtrm again, its triggering immediately.
Am i doing some blunder here? without runmqtrm will it trigger automatically? |
|
Back to top |
|
 |
learnmqnow |
Posted: Mon Oct 31, 2005 12:48 am Post subject: |
|
|
Novice
Joined: 04 Oct 2005 Posts: 13 Location: Bangalore, India
|
ok..then pls tell me how to run a trigger monitor as a background process??? pls tell me all the relevant steps..changes in process defn attributes, where to give runmqtrm command etc..
and one more thing.even if i do a CTRL+Z , the process is still alive. I'll hv to explicitly kill to remove it. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Oct 31, 2005 2:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
No triggering occurs unless a trigger monitor is running.
We've told you how to run a trigger monitor in the background, using & and nohup.
If a process is running in the background, then it will not "end" unless you explicitly kill it. That's why you run it in the background in the firstplace.
Runmqtrm will quit if the qmgr shuts down, regardless of if it's running in the background or not. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
learnmqnow |
Posted: Mon Oct 31, 2005 3:29 am Post subject: |
|
|
Novice
Joined: 04 Oct 2005 Posts: 13 Location: Bangalore, India
|
Hi,
I've solved the problem. But i dont think it's a neat solution though.
My problem was that i hv 16 trigger monitors running at a time, and it was really a mess with 16 terminals running at a time.
What u suggested was to use & and nohup. After using it i expected that after issuing the runmqtrm command, may b it will start in background leaving the terminal safe to close. But this was not the case. It was displaying 'waiting for trigger message' . So i tried doing a CTRL+Z hoping that its not actually terminating the trigger. But after that it didnt trigger.
Then instead of CTRL+Z, i simply closed the terminal using RHS top 'X'.
Now its triggering properly, ie log files are generated and messages are off the queue. Just to check, i removed the & and the nohup and again closed the terminal. To my amazement the trigger still ran.
Correct me if i am wrong, but from what i saw nohup has nothing to do with background process, it simply writes the print statements to a file nohup.out. It can be useful if we have no other ways to detect whether a program ran or not. May b that is what u meant also..But i was writing to a log file already..
And for the use of '&' am absolutely clueless..i dont knw if its an operating system specific behaviour..but it did not help me to start process in background.
I searched in the google before posting here and got the same solutions(to use &) , but it didnt work for me. I read that & helps to create a new process everytime instead of keeping the existing process waiting.
sorry if am making u to repeat the same things again..but it'll b great if u can clarify this for me. |
|
Back to top |
|
 |
EddieA |
Posted: Mon Oct 31, 2005 9:30 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
It was displaying 'waiting for trigger message' |
In which case there was a problem in the way you issued the command.
Quote: |
My problem was that i hv 16 trigger monitors running at a time |
Why. You can use a single TM to handle multiple Queues being triggered.
Quote: |
but from what i saw nohup has nothing to do with background process |
Yes, nohup doesn't send the process to the background.
Quote: |
it simply writes the print statements to a file nohup.out |
No, it does a little more than that. If a user starts a process, then when that user logs off the process is also stopped. Using nohup "disassociates" the user and the process, so when the user logs off, the process continues.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
mrlinux |
Posted: Mon Oct 31, 2005 10:36 am Post subject: |
|
|
 Grand Master
Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA
|
Please show the where you had the & in the process of starting the runmqtrm command. _________________ Jeff
IBM Certified Developer MQSeries
IBM Certified Specialist MQSeries
IBM Certified Solutions Expert MQSeries |
|
Back to top |
|
 |
|