LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Daemon User (https://www.linuxquestions.org/questions/linux-newbie-8/daemon-user-310907/)

redijedi 04-07-2005 07:37 PM

Daemon User
 
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

Thanks,
T

btmiller 04-07-2005 09:15 PM

What are the permissions on /opt/jboss-4.0.1sp1/bin -- you can do "ls -ld /opt/jboss-4.0.1sp1/bin" (no quotes) to see them.

redijedi 04-07-2005 09:20 PM

Thanks for the quick reply. I have been messing with chown and chmod on these dirs with -R. Here's the latest:

drwxr-x--- 2 jbossd root 4096 Apr 7 17:30 /opt/jboss-4.0.1sp1/bin

redijedi 04-10-2005 11:45 AM

I figured out that my jboss user was the problem. Now, however I still can't get JBoss started. I keep getting:

[root@localhost init.d]# service jbossd start
CMD_START = cd /usr/local/jboss-4.0.1sp1/bin; /usr/local/jboss-4.0.1sp1/bin/run.sh -c all

That's all. Nothing starts. Just this output.

Thanks

btmiller 04-10-2005 12:23 PM

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.

redijedi 04-10-2005 02:10 PM

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


allanpro 03-06-2006 07:48 AM

I had the same problem.

The solution to me was to change this:

Code:

JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c all"}
to this:

Code:

JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh"}
As I have only the default server installed (via the JBoss installer.jar).

schultzg 06-15-2006 05:49 PM

-->I figured out that my jboss user was the problem. Now, however I still can't get JBoss started. I keep getting:

I am having the same problem "This account is not currently available". Can you explain what was actually done to fix the jboss user on your system?

geniepower 10-30-2006 02:48 PM

Hi Guys,

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.

Enjoy

geniepower 10-30-2006 02:50 PM

Please let me know if it works for you.


All times are GMT -5. The time now is 01:47 AM.