Jump to content

Trouble installing jboss as a service - SOLVED


Recommended Posts

I have an web application I have installed on mandrake 10.0 CE.

 

The application runs within Jboss.

 

I used Webmin to add it at a service (easier than doing it in command-line)

 

The problem I am having is that at startup, all the services start untill it gets to my application. The application starts and works perfectly, but after it has started, it does not say OK and continue with the next service.

 

Here is the script webmin wrote for me:

 

#!/bin/sh

# chkconfig: 2345 99 00

case "$1" in

'start')

/home/workpool/Workpool4/jboss/bin/run.sh

touch /var/lock/subsys/WorkPool

;;

'stop')

/home/workpool/Workpool4/jboss/bin/shutdown.sh -S

rm -f /var/lock/subsys/WorkPool

;;

*)

echo "Usage: $0 { start | stop }"

;;

esac

 

How can I change this so that it can continue with the next service. I think the problem might be caused by jboss. When I run the script normally, I have to run it in the background (&) as it continues to run until you close it. I tried adding a & after the "run.sh" , but it does not seem to start up then.

 

Thanks in advance. I know the solution is probably frightfully simple. :jester:

Edited by Sapphiron
Link to comment
Share on other sites

I'm confused because my understanding of JBoss from what I've done, is that you simply start JBoss as a service, and then you ensure that the application you wish to deploy is within the deploy folder of JBoss.

That really "should" be all you need to do. I don't understand why you want to start the application as a second service - if you have more than one, just put it in a second folder within JBoss deployment folder, with the relevant jini settings etc within the application..

 

The idea with JBoss is that it has the application available, but doesn't load it until someone requestes it (thus keeping it out of memory and wasting space). Therefore to load it, you just need to go to the URL that you wrote in the jini file as belonging to the application. If the app isn't being used, JBoss will remove it from its memory and keep it sat in the background until its requested again.

 

Therfore, in answer to the question, have JBoss running, "deploy" the application to JBoss, ensure it works. Add JBoss (and ONLY JBoss) as a service if you wish to start it automagically, sit back and enjoy.

Link to comment
Share on other sites

Sorry, I probably did not make it clear enough. let me try again.

 

I have 1 application running in jboss.

I want to start that jboss as a service.

I normally do this by running the run.sh script in the jboss/bin folder.

When I run the script with a '&', it runs fine.

 

The problem comes in when I want to start it as a service.

When the machine boots up all goes fine until it starts jboss.

Jboss starts sucessfully, but control isnot returned to the system (ie it does not finish booting)

 

I tried to fix this by adding a '&' after the run.sh.

Everything is fine then, but jboss (and my application) does not start.

 

Hope this is a bit more clear.

 

Again Thanks in advance.

Link to comment
Share on other sites

OK... what you need to do is actually add an entry to rc.d/ run level you want it to run at.

 

I can't walk you through this right now, but someone else here might be able to, otherwise I believe its available in the tutorials.

 

Basically, you need to add K (kill) files for the service to all runlevels you don't want the service to run at (say 0 (halt..) and S (start) to all runlevels you want it to run at - such as 3 (CLI) and 5 (GUI).

If you also add a script to init.d you can use "service jboss start / stop". I'll try and write how you do this for you on sunday / monday, otherwise have a look through the tutorials, there should be one about manual rc.d and init.d scripts.

 

Otherwise, take a look at the files in /etc/rc.d/rc.3, rc.5 and rc.0 and copy them making your own changes. Also look in /etc/init.d and do the same there. This really is the best way to do it I'm afraid...

Link to comment
Share on other sites

Ok I checked the entries in the runlevels. They seem to be in order. (Webmin is a cool tool).

 

Thanks for the info so far :thanks:

 

I'm going to try the "service jboss start/stop"-thingy in the init.d, but I'm a bit clueless, so your help would be very much appreciated.

Link to comment
Share on other sites

Ok i tried somthing.

 

Since Jboss constantly writes it status and action to the console, I thought that might be the problem, so I did changed the script to the following:

#!/bin/sh

# chkconfig: 2345 99 00

case "$1" in

'start')

/home/workpool/Workpool4/jboss/bin/run.sh > /dev/null

touch /var/lock/subsys/WorkPool

;;

'stop')

/home/workpool/Workpool4/jboss/bin/shutdown.sh -S

rm -f /var/lock/subsys/WorkPool

;;

*)

echo "Usage: $0 { start | stop }"

;;

esac

 

This however still does not solve the problem. This is starting to frustrate me.

Link to comment
Share on other sites

CRACKED IT.

 

I changed the script to the following and it worked

I would like to thank the furom and my linux guru, who came up with the solution.

 

#!/bin/sh

# chkconfig: 2345 99 00

 

case "$1" in

'start')

/home/workpool/Workpool4/jboss/bin/run.sh > /home/workpool/start.log 2>&1 &

touch /var/lock/subsys/WorkPool

;;

'stop')

/home/workpool/Workpool4/jboss/bin/shutdown.sh -S > /home/workpool/stop.log 2>&1 &

rm -f /var/lock/subsys/WorkPool

;;

*)

echo "Usage: $0 { start | stop }"

;;

esac

 

Yipee!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...