-
1. Re: jboss service start script for ubuntu linux
wdfink Aug 14, 2011 5:52 AM (in response to javatwo)I would start from redhat one. The Linux distributions, or Unix, often have different path philosophy (/usr/.. /usr/local/... /etc/init.d etc).
So you have to adapt the path for Java/JBoss/...
The script itselve should work.
Also providing a script might not help because, apart from that I'm having no Ubuntu, each installation might be different and the script will not work as you want.
Also you will understand how the script work
-
2. Re: jboss service start script for ubuntu linux
peterj Aug 15, 2011 11:48 AM (in response to javatwo)You can use any of them as a base - I usually use the redhat one since I work with both Fedora and CentOS as well as Ubtunu. Customize the file for your system (the settings to costomize are located at the start of the file) and then copy to /etc/init.d as, for example, /etc/init.d/jboss. And now is where it gets more difficult - other distros have a tool you can use to mark services to be auto-started on boot but Ubuntu has dropped that. So you will have to follow instructions such as these: http://www.liberiangeek.net/2010/05/how-to-start-stop-services-in-ubuntu-lucid-automatically/
-
3. Re: jboss service start script for ubuntu linux
javatwo Aug 18, 2011 11:12 AM (in response to peterj)thanks for help.
I tried the one for red hat, it worked on ubuntu without any changes. Great!
sudo service jboss start
jboss was started successfully.
However, when I used java to start jboss service, and tried to capture output, the readLine() blocked after reading all outputs.ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"service", "jboss" , "start"});
Process p = processBuilder.start();
InputStream is = p.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = reader.readLine()) != null)
System.out.println(line);
the jboss started successfully from: ps aux | grep javabut the reader.readLine() blocked after reading all outputs. It seemed it did not see EOF, waiting for more input.
On ubuntu, the same code worked for reading output from starting mysql service, but not for jboss. I have not figured outwhat is the difference? they are both commands executed as Process.
thanks for help.
Dave
-
4. Re: jboss service start script for ubuntu linux
javatwo Aug 18, 2011 11:13 AM (in response to javatwo)the above code worked on Fedora core 14 for both mysql and jboss.
-
5. Re: jboss service start script for ubuntu linux
peterj Aug 18, 2011 11:30 AM (in response to javatwo)Maybe it has something to do with stdout and stderr being redirected to /dev/null in the startup script. Since the one for mysql works, you should compare it to the JBoss one and see how each one handles stdout/stderr.
-
6. Re: jboss service start script for ubuntu linux
javatwo Aug 18, 2011 10:04 PM (in response to peterj)For jboss start command,
eval $JBOSS_CMD_START >$JBOSS_CONSOLE 2>&1 &
after I removed >$JBOSS_CONSOLE 2>&1, it did not solve the problem.
Mysql start script has the similar: >/dev/null 2>&1.
If I remove eval, the jboss will not start. but the stop command does not need eval.
echo $JBOSS_CMD_START
will print out the command, it seems it does not need eval.
thanks for help.
Dave