LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-12-2005, 10:59 PM   #1
eric.r.turner
Member
 
Registered: Aug 2003
Location: Planet Earth
Distribution: Linux Mint
Posts: 216

Rep: Reputation: 31
Starting JBoss At Boot On Slackware 10.0


Ok, I've installed JBoss 4 on Slackware 10.0 and can start it as user "jboss". Now I'm working on modifying the canned jboss_init_suse.sh script that comes with JBoss to start it at boot time. I'm calling it /etc/rc.d/rc.jboss:
Code:
#!/bin/sh
#
# JBoss Control Script
#
# To use this script
# run it as root - it will switch to the specified user
# It loses all console output - use the log.
#

#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/usr/local/jboss"}

#make java is on your path
JAVAPTH=${JAVAPTH:-"/usr/lib/java/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 default"}

#define what will be done with the console log
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/usr/local/jboss/server/default/log/jboss.log"}

#define the user under which jboss will run, or use RUNASIS to run as the current user
JBOSSUS=${JBOSSUS:-"jboss"}

CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"
CMD_SETPATH="export PATH=$PATH:$JAVAPTH"

SUBIT="su - $JBOSSUS -c "

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

case "$1" in
start)
    echo -n "Starting JBoss application server: "
    cd $JBOSS_HOME/bin
    if [ -z "$SUBIT" ]; then
        eval $CMD_START >${JBOSS_CONSOLE} 2>&1 &
    else
        $SUBIT "$CMD_SETPATH; $CMD_START >${JBOSS_CONSOLE} 2>&1 &"
    fi
    ;;
stop)
    echo -n "Shutting down JBoss application server: "
    if [ -z "$SUBIT" ]; then
        $CMD_STOP
    else
        $SUBIT "$CMD_SETPATH; $CMD_STOP"
    fi
    ;;
restart)
    $0 stop
    $0 start
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac
I'm invoking rc.jboss stop from /etc/rc.d/rc.6 and /etc/rc.d/rc.K like this:
Code:
if [ -x /etc/rc.d/rc.jboss ]; then
   /etc/rc.d/rc.jboss stop
fi
and invoking rc.jboss start from /etc/rc.d/rc.M like this:
Code:
if [ -x /etc/rc.d/rc.jboss ]; then
   . /etc/rc.d/rc.jboss start
fi
Everything seems to be working fine. My question is why do I have to invoke
Code:
$SUBIT "$CMD_SETPATH; $CMD_START"
rather than
Code:
$SUBIT "$CMD_START"
If I don't set the path after suing to jboss, then I get an error from the jboss run.sh script saying it can't find the java command.

Also, what does the "." in ". /etc/rc.d/rc.jboss start" in rc.M do for me (I just copied it since that's what they're doing with everything else like rc.http, etc)?

Thanks!
 
Old 05-08-2005, 04:39 PM   #2
BigDuke6
LQ Newbie
 
Registered: Jul 2003
Location: Stockholm, Sweden
Posts: 1

Rep: Reputation: 0
Hi Eric!

Have you had any progress with the script since you posted this?

I'm in the same shoes you were in a few months ago, running jboss on slackware...
 
Old 01-27-2010, 03:54 PM   #3
lajp
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by eric.r.turner View Post
Ok, I've installed JBoss 4
Everything seems to be working fine. My question is why do I have to invoke
Code:
$SUBIT "$CMD_SETPATH; $CMD_START"
rather than
Code:
$SUBIT "$CMD_START"
If I don't set the path after suing to jboss, then I get an error from the jboss run.sh script saying it can't find the java command.

Also, what does the "." in ". /etc/rc.d/rc.jboss start" in rc.M do for me (I just copied it since that's what they're doing with everything else like rc.http, etc)?

Thanks!
This is just educated guesses, but:

1. $SUBIT "$CMD_SETPATH; $CMD_START"
$SUBIT is changing the user jboss is run under, as a result, the user is going to have their own 'clean' environment, which will include not having their $PATH set to include java et al. So, after su'ing to the user, $CMD_SETPATH must be called to set the path for that user's environment.

2. ". /etc/rc.d/rc.jboss start"
You've stumped me on this. In bash if you type just '.' you get the following:
Code:
$ .
bash: .: filename argument required
.: usage: . filename [arguments]
So it appears to be some kind of execution prompt for scripts. When I tried "$ . ls" I get an error about elf
-bash: ELF: command not found
It appears to be a launch point. Why's it's being done I'm not sure. Unless they're strictly enforcing that only scripts should be called?

References:
Bash Scripting Guide
Bash Reference Manual
 
Old 01-27-2010, 04:11 PM   #4
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
@lajp - this post is almost five years old so I doubt the OP will still be reading this. Please check this when dragging up very old posts as they are outdated and hence often now irrelevant. Re your quandry - heres some information that may help :
Quote:
2. ". /etc/rc.d/rc.jboss start"
You've stumped me on this. In bash if you type just '.' you get the following:
Code:

$ .
bash: .: filename argument required
.: usage: . filename [arguments]

So it appears to be some kind of execution prompt for scripts. When I tried "$ . ls" I get an error about elf
-bash: ELF: command not found
It appears to be a launch point. Why's it's being done I'm not sure. Unless they're strictly enforcing that only scripts should be called?
This is known as the dot command and is the same as sourcing. The full stop (".") is a bash built-in and has the same effect as running "source filename" i.e. it reads commands from the file named filename.

Last edited by bgeddy; 01-27-2010 at 04:15 PM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Jboss tvenegas Linux - Software 0 05-02-2005 09:44 AM
Won't Boot - Starting Printer Service - Starting CUPS jeansond Linux - Newbie 0 10-11-2004 06:39 PM
starting with slackware ... manu2004 Slackware 2 01-05-2004 06:58 PM
Starting with Slackware Scarface Slackware 29 10-12-2003 09:19 AM
starting X in slackware TheOneAndOnlySM Linux - Newbie 5 08-01-2003 10:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:07 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