LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-14-2003, 10:21 AM   #1
hvdwatt
LQ Newbie
 
Registered: Jun 2003
Posts: 6

Rep: Reputation: 0
jboss daemon


Hi

I want to get JBoss to start on bootup and want to create a daemon for it.

What do I do.

Thanks

Hendrik

 
Old 06-14-2003, 11:49 AM   #2
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 47
Take a look at your /etc/rc.d dir.

All startup services are placed there. You just need to pick which rc.num file Jboss should be called on.
 
Old 06-15-2003, 03:55 AM   #3
hvdwatt
LQ Newbie
 
Registered: Jun 2003
Posts: 6

Original Poster
Rep: Reputation: 0
Thumbs up jboss daemon

I have created the appropriate startup scripts for run level 3, but are still having problems to get jboss to start automatically. If I run the script manually it seems to work fine, but it does not run if it is in the rc3.d dir. Should I get it to start early or late ? i.e. S01 or S90.

Thanks

Hendrik
 
Old 06-15-2003, 04:56 AM   #4
hvdwatt
LQ Newbie
 
Registered: Jun 2003
Posts: 6

Original Poster
Rep: Reputation: 0
jboss daemon

here is the script that i use

#!/bin/sh #
# Startup script for JBOSS, the J2EE EJB Server
#
# chkconfig: 2345 95 15
#!/bin/sh #
# Startup script for JBOSS, the J2EE EJB Server
#
# chkconfig: 2345 95 15
# description: JBoss is an EJB Server
# processname: jboss
# pidfile: /var/run/jboss.pid
# config: /usr/local/jboss/conf/default/jboss.conf
# logfile: /usr/local/jboss/log/server.log
#
# version 1.0 -
# version 1.1 - kjenks - Start Tomcat, too.
#
# Source function library. .
/etc/rc.d/init.d/functions
#SET THE FOLLOWING LINE TO YOUR JAVA_HOME
export JAVA_HOME=/usr/java/j2sdk1.4.1_03
#SET THE FOLLOWING LINE TO YOUR CORRECT JBOSS_HOME
export JBOSS_HOME=/usr/local/jboss
export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
echo $PATH
#IF YOU NEED SPECIAL CLASSES IN YOUR CLASSPATH
#AT STARTUP, ADD THEM TO YOUR CLASSPATH HERE
#export CLASSPATH=
RETVAL=0
# See how we were called.
case "$1" in
start)
cd $JBOSS_HOME/bin
echo -n "Starting jboss daemon: "
daemon $JBOSS_HOME/bin/go.sh start
RETVAL=$?
echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/jboss
;;
stop)
echo -n "Stopping jboss daemon: "

when i run the script (./jboss start root user has read write execute rights) I get the following error:

#: #: No such file or directory
 
Old 06-16-2003, 04:18 PM   #5
hvdwatt
LQ Newbie
 
Registered: Jun 2003
Posts: 6

Original Poster
Rep: Reputation: 0
Smile jboss daemon

I have fixed the problem and the JBoss startup script now works nicely.

I have created a script called jboss that resides in /etc/init.d with root execute permissions. From here I create a startup symbolic link in /etc/rc3.d called S65Jboss and a stop symbolic link called K16Jboss that kills the daemon.

Works like a dream.

Here is the jboss script
##########################################

#!/bin/bash
. /etc/rc.d/init.d/functions
#SET THE FOLLOWING LINE TO YOUR JAVA_HOME
export JAVA_HOME=/usr/java/j2sdk1.4.1_03
#SET THE FOLLOWING LINE TO YOUR CORRECT JBOSS_HOME
export JBOSS_HOME=/usr/local/jboss
export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
RETVAL=0
case "$1" in
start)
cd $JBOSS_HOME/bin
echo -n "Starting jboss daemon: "
daemon $JBOSS_HOME/bin/go.sh start
RETVAL=$?
echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/jboss
;;
stop)
echo -n "Stopping jboss daemon: "
killproc jboss
RETVAL=$?
echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/jboss
;;
restart)
echo -n "Restarting jboss daemon: "
$0 stop
sleep 2
$0 start
;;
esac

##########################################

You also require a go.sh script in the JBOSS_HOME directory like this:

##########################################

#!/bin/bash
export JBOSS_HOME=/usr/local/jboss
export JAVA_HOME=/usr/java/j2sdk1.4.1_03
JAVACMD=$JAVA_HOME/bin/java
# Minimal jar file to get JBoss started.
CLASSPATH=$CLASSPATH:$JBOSS_HOME/bin/run.jar
# Add the tools.jar file so that Tomcat can find the Java compiler.
CLASSPATH="$CLASSPATH:$JAVA_HOME/lib/tools.jar"
if [ "$1" = "start" ] ; then
shift
$JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main .c tomcat > /dev/null 2>&1 &
echo $! > /var/run/jboss.pid
elif [ "$1" = "stop" ] ; then
shift
kill -15 `cat /var/run/jboss.pid`
rm -rf /var/run/jboss.pid
elif [ "$1" = "run" ] ; then
shift
$JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main .c tomcat "$@"
else
echo "Usage:"
echo "jboss (start|run|stop)"
echo " start - start jboss in the background"
echo " run - start jboss in the foreground"
echo " stop - stop jboss"
exit 0
fi

##########################################

Thats it implement these and make sure that JBOSS_HOME and JAVA_HOME point to your JBoss installed dir and your JDK installed dir respectfully and your set.


Cheers

Hendrik
 
Old 06-16-2003, 06:47 PM   #6
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Rep: Reputation: 30
this is cool.... i will have a try on it....
 
Old 01-10-2005, 10:11 AM   #7
eliosh
LQ Newbie
 
Registered: Jan 2005
Location: Italy
Distribution: Gentoo, Red Hat
Posts: 1

Rep: Reputation: 0
Thumbs up

Magic Script !!!!!

thank a lot !!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
JBoss Question Hockeyfan Linux - Software 1 07-01-2005 07:07 PM
Jboss tvenegas Linux - Software 0 05-02-2005 09:44 AM
Why is JBoss complaining? eantoranz Programming 0 04-26-2005 09:56 AM
Taroon with Jboss mlyra Red Hat 0 02-14-2005 01:19 PM
jboss daemon yenonn Linux - General 0 04-29-2004 08:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration