Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm a Linux noob, but have been working with JBoss for a while now on windows. I am trying to follow JBoss's doc on getting the server to run as a service. I am attempting to create a user for this daemon. I believe I have it correct, yet when I attemp to run the service script I get the following:
[root@localhost opt]# /opt/jboss-4.0.1sp1/bin/jboss_init_redhat.sh start
CMD_START = cd /opt/jboss-4.0.1sp1/bin; /opt/jboss-4.0.1sp1/bin/run.sh -c all
su: warning: cannot change directory to /opt/jboss-4.0.1sp1/bin: Permission denied
This account is currently not available.
My thought is that this has something to do with the jbossd user account that I created.
From etc/passwd:
jbossd:x:501:3:JBoss Server:/opt/jboss-4.0.1sp1/bin:/sbin/nologin
Normally when daemons start they don't print any sort of messages. You can do ps aux and look for the JBoss process to see if it's running. You can use netstat too to make sure it's listening on the correct port. If it's not, you should probably look at the logfiles the application generates. There may also be a verbose output option you can start it with that might give a better clue about the problem -- you'll have to consult the documentation.
Unfortunately, there is little documentation other than the script provided by JBoss. I've done quite a bit of googling on this topic with little results. ps aux does not show it running. netstat does not show it listening. The JBoss logs do not seem to have been touched. I don't think it's doing anything.
The output is coming from the JBoss start up file, but that seems to be all it's doing.
Below is the script provided by JBoss with my alterations:
Code:
#!/bin/sh
#
# JBoss Control Script
#
# chkconfig: 3 80 20
# description: JBoss EJB Container
#
# To use this script
# run it as root - it will switch to the specified user
# It loses all console output - use the log.
#
# Here is a little (and extremely primitive)
# startup/shutdown script for RedHat systems. It assumes
# that JBoss lives in /usr/local/jboss, it's run by user
# 'jboss' and JDK binaries are in /usr/local/jdk/bin. All
# this can be changed in the script itself.
# Bojan
#
# Either amend this script for your requirements
# or just ensure that the following variables are set correctly
# before calling the script
# [ #420297 ] JBoss startup/shutdown for RedHat
#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/usr/local/jboss-4.0.1sp1"}
#make java is on your path
JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.5.0_02/bin"}
#define the classpath for the shutdown class
JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c all"}
if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then
# ensure the file exists
touch $JBOSS_CONSOLE
fi
if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then
echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"
echo "WARNING: ignoring it and using /dev/null"
JBOSS_CONSOLE="/dev/null"
fi
#define what will be done with the console log
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}
#define the user under which jboss will run, or use RUNASIS to run as the current user
JBOSSUS=${JBOSSUS:-"jbossd"}
CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"
if [ "$JBOSSUS" = "RUNASIS" ]; then
SUBIT=""
else
SUBIT="su - $JBOSSUS -c "
fi
if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
export PATH=$PATH:$JAVAPTH
fi
if [ ! -d "$JBOSS_HOME" ]; then
echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
exit 1
fi
echo CMD_START = $CMD_START
case "$1" in
start)
cd $JBOSS_HOME/bin
if [ -z "$SUBIT" ]; then
eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
else
$SUBIT "$CMD_START >${JBOSS_CONSOLE} 2>&1 &"
fi
;;
stop)
if [ -z "$SUBIT" ]; then
$CMD_STOP
else
$SUBIT "$CMD_STOP"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart|help)"
esac
I have got mine working. - CENTOS 4.4, jdk.1.5.0_08, jboss-4.0.4.GA
Simplied answer is:
I installed jboss in /opt ie /opt/jboss-4.0.4.GA
Copy the jboss_init_redhat.sh as jboss in init.d
# cp /opt/jboss-4.0.4.GA/bin/jboss_init_redhat.sh /etc/init.d/jboss
Code:
Change the following lines in the jboss
#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/opt/jboss-4.0.4.GA"}
~~~~~~~~~~~~~~~~~~~
#make java is on your path
JAVAPTH=${JAVAPTH:-"/usr/java/jdk.1.5.0_08"}
~~~~~~~~~~~~~~~~~~~~~~
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh"}
~~~~~~~~~~~~
#define the user under which jboss will run, or use RUNASIS to run as the current user
JBOSSUS=${JBOSSUS:-"root"}
~~~~
And copied the start bit as status also. See below. Then SAVE File.
case "$1" in
start)
cd $JBOSS_HOME/bin
if [ -z "$SUBIT" ]; then
eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
else
$SUBIT "$CMD_START >${JBOSS_CONSOLE} 2>&1 &"
fi
;;
status)
cd $JBOSS_HOME/bin
if [ -z "$SUBIT" ]; then
eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
else
$SUBIT "$CMD_START >${JBOSS_CONSOLE} 2>&1 &"
fi
;;
stop)
if [ -z "$SUBIT" ]; then
$CMD_STOP
else
$SUBIT "$CMD_STOP"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 (start|stop|restart|help)"
esac
On the menu,
goto Server Settings->Services, enter root password.
goto Actions->Add Service
enter jboss
click on the checkbox for jboss, save.
Reboot the server.
Give enough time for the jboss to complete it's startup and test.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.