Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-12 Thread Tom Cook

Yep, looks pretty handy to me.  While you're asking for timestamped logs, how
about log rotation, as well?  I've been meaning to write it for a while,
haven't quite got there...

Tom

On Tue, 13 Feb 2001, you wrote:
> Greetings,
> 
> Here is another version of the Linux jboss init script.
> Thanks to Michael Drew, Toby Allsopp, and Tom Cook for their help.
> 
> If this seems okay, I'll send it on to the jboss-dev list.
> 
> 1. First some suggested options to run.sh.
> I have left all logging to jboss, though I am a bit
> frustrated that the jboss log is not time-stamped. I'll
> add this as a wish-list when I post to jboss-dev.
> 
> 2. Second a jboss init script.
> 
> There are some differences between how jboss will run as a service,
> and how jboss will run when started from a user's shell due to the
> way jboss loads its classpath. When started from a shell it first adds
> "run.jar" to the users $CLASSPATH. When started as a service this classpath
> 
> will be empty. I have put a reminder in the init script to add special
> classpath
> information should it be needed.
> 
> 
> Thus, for "run.sh" , ommitting most details, including the jetty and tomcat
> 
> options,
> I suggest something along the following lines, where the user can choose to
> run
> in the foreground or background.
> 
> ###
> #!/bin/sh
> #
> ...
> ## Shell script to start and stop the server
> ...
> iif [ "$JAVACMD" = "" ] ; then
> if [ -d ${JAVA_HOME}/lib/i386 ] ; then
># We are probably in a SUN/Balckdown environment ...
>JAVACMD="$JAVA_HOME/bin/java -server"
> else
># it is probably Big Blue ...
>JAVACMD=$JAVA_HOME/bin/java
> fi
> fi
> 
> if [ "$1" = "start" ] ; then
>   shift
>   $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main "$@" >
> /dev/null 2>&1 &
>   echo $! > /var/run/jboss.pid
> 
> elif [ "$1" = "stop" ] ; then
>   shift
>   kill -15 `cat /var/run/jboss.pid`
> 
> elif [ "$1" = "run" ] ; then
>   shift
>   $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH   org.jboss.Main "$@"
> 
> 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
> 
> ##
> 
> #!/bin/sh
> #
> # Startup script for JBOSS, the J2EE EJB Server
> #
> # chkconfig: 2345 85 15
> # description: Jboss is an EJB Server
> # processname: jboss
> # pidfile: /var/run/jboss.pid
> # config: ${JBOSS_HOME}/conf/default/jboss.conf
> # logfile: ${JBOSS_HOME}/log/server.log
> #
> #
> # version 1.2 -
> #
> 
> # Source function library.
> . /etc/rc.d/init.d/functions
> 
> #SET THE FOLLOWING LINE TO YOUR JAVA_HOME !
> export JAVA_HOME=/opt/jdk
> #export JAVA_HOME=/usr/java/jdk1.3  #SUN's rpm
> #export JAVA_HOME=/opt/IBMJava2-13  #IBM's rpm
> 
> #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
> 
> #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/run.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
> ;;
> 
> 
> 
> --
> --
> To subscribe:[EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> List Help?:  [EMAIL PROTECTED]


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re[2]: [jBoss-User] Starting jBoss as a service on Linux

2001-02-12 Thread Ingo Bruell

Hi jBoss,

CA> Greetings,

CA> Here is another version of the Linux jboss init script.
CA> Thanks to Michael Drew, Toby Allsopp, and Tom Cook for their help.

CA> If this seems okay, I'll send it on to the jboss-dev list.

CA> 1. First some suggested options to run.sh.
CA> I have left all logging to jboss, though I am a bit
CA> frustrated that the jboss log is not time-stamped. I'll
CA> add this as a wish-list when I post to jboss-dev.

But  you  know  the  way  to  put  date  and time into the log ? It is
described in the manual under "Logging".

so long


Ingo Bruell

---
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>

OldenburgPGP-Fingerprint: CB01 AE12 B359 87C4 BF1C  953C 8FE7 C648 169E E5FC
Germany  PGP-Public-Key available at pgpkeys.mit.edu




--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-12 Thread Christopher Albert

Greetings,

Here is another version of the Linux jboss init script.
Thanks to Michael Drew, Toby Allsopp, and Tom Cook for their help.

If this seems okay, I'll send it on to the jboss-dev list.

1. First some suggested options to run.sh.
I have left all logging to jboss, though I am a bit
frustrated that the jboss log is not time-stamped. I'll
add this as a wish-list when I post to jboss-dev.

2. Second a jboss init script.

There are some differences between how jboss will run as a service,
and how jboss will run when started from a user's shell due to the
way jboss loads its classpath. When started from a shell it first adds
"run.jar" to the users $CLASSPATH. When started as a service this classpath

will be empty. I have put a reminder in the init script to add special
classpath
information should it be needed.


Thus, for "run.sh" , ommitting most details, including the jetty and tomcat

options,
I suggest something along the following lines, where the user can choose to
run
in the foreground or background.

###
#!/bin/sh
#
...
# Shell script to start and stop the server
...
if [ "$JAVACMD" = "" ] ; then
if [ -d ${JAVA_HOME}/lib/i386 ] ; then
   # We are probably in a SUN/Balckdown environment ...
   JAVACMD="$JAVA_HOME/bin/java -server"
else
   # it is probably Big Blue ...
   JAVACMD=$JAVA_HOME/bin/java
fi
fi

if [ "$1" = "start" ] ; then
  shift
  $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main "$@" >
/dev/null 2>&1 &
  echo $! > /var/run/jboss.pid

elif [ "$1" = "stop" ] ; then
  shift
  kill -15 `cat /var/run/jboss.pid`

elif [ "$1" = "run" ] ; then
  shift
  $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH   org.jboss.Main "$@"

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

##

#!/bin/sh
#
# Startup script for JBOSS, the J2EE EJB Server
#
# chkconfig: 2345 85 15
# description: Jboss is an EJB Server
# processname: jboss
# pidfile: /var/run/jboss.pid
# config: ${JBOSS_HOME}/conf/default/jboss.conf
# logfile: ${JBOSS_HOME}/log/server.log
#
#
# version 1.2 -
#

# Source function library.
. /etc/rc.d/init.d/functions

#SET THE FOLLOWING LINE TO YOUR JAVA_HOME !
export JAVA_HOME=/opt/jdk
#export JAVA_HOME=/usr/java/jdk1.3  #SUN's rpm
#export JAVA_HOME=/opt/IBMJava2-13  #IBM's rpm

#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

#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/run.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
;;



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-11 Thread Tom Cook

On Mon, 12 Feb 2001, you wrote:
> Tom Cook wrote:
> > Also ${...} does not work like that on any bash I have installed, but I'm still
> > RedHat 6.2 and Tru64 5.0.4, so maybe that's it.
> 
> We're talking about dollar parenthesis, not dollar brace. It should
> work.

 all right, that argument was because I didn't read
someone's mail close enough somewhere near the top of this thread.  My
apologies to all involved.

Tom


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-11 Thread Tom Cook

On Fri, 09 Feb 2001, you wrote:
> Hello Tom,

Hello Philipp,

[snip]
> > I agree with Toby on this, it is not portable... in fact I can't find a
shell > > in which it works.  This syntax is for environment variables, what
you are > > looking for is
> 
> It's bash syntax and means the same as backticks. (At least my linux bash
> and zsh support it).

Hm, I hadn't come across that in bash before, and it doesn't work in
bash 1.14.7(1), which is wat I've got; I get, variously, nothing or 'bad
substitution'.  But then I haven't upgraded bash in a long time on my system.

If this is now the meaning of ${...}, then how do you now express things like:

${FILENAME_PREFIX}filename.typ

where

$FILENAME_PREFIXfilename.typ

will try to use the wrong variable?

> > kill -9 `cat /var/run/jboss.pid`
> > 
> > note that backwards single quotes.
> 
> I'm unsure if a kill -9 is the right way to do this?! Jboss has no chance
> to enter it's shutdown hook!

Yes, someone else has pointed this out, also.  I was not suggesting that kill
-9 was the way to go, but I was just taking the script sent to the list and
modifying it in this particular.

Tom


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-11 Thread Tom Cook

On Sat, 10 Feb 2001, you wrote:
[snip]
> My preferred option would be to keep the $(...) syntax and change the 
> shell it uses to ksh. I depends how portable you want it. I don't know 
> of a UNIX or UNIX-like system that doesn't have ksh. ksh is preferable 
> to sh for scripting in almost every way (see the recent /. interview 
> with Mr Korn).
> 
> Of course, the problem with this is that then you need to change the 
> filename from .sh to .ksh so as not to mislead people. A solution to 
> this is to leave off the .sh altogther. A better solution is to treat 
> the .sh or .ksh as a source file and "compile" it to a file without the 
> .sh or .ksh. This compilation step can then fill in the appropriate path 
> tto the desired shell on the target system for the #! bit at the top.

Given that we are using this in a startup script, it might not be a good thing
to use ksh.  I personally (and I think a lot of other people, but I'm not sure)
put ksh in /usr/local/bin, which is not necessarily available at all points
during the boot.  I do this because I like to keep all things in /bin
statically linked, so it's all there when I need to do a bare minimum boot. 
Also, many linux systems don't come with ksh by default.  So you can guarantee
/bin/sh to be on pretty much _every_ UNIX under the Sun (sorry, couldn't
resist that pun), but ksh is not as ubiquitous.

Also ${...} does not work like that on any bash I have installed, but I'm still
RedHat 6.2 and Tru64 5.0.4, so maybe that's it.

Tom


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-11 Thread Tom Cook

On Sat, 10 Feb 2001, you wrote:
> Tom Cook wrote:
> 
> > On Thu, 08 Feb 2001, you wrote:
> > > Greetings,
> > [snip]
> > > Toby suggested using $! to capture the PID of the Java process launched in the
> > > background. While I dont think this will work in the init.d/jboss script it will
> > > work by adding it to $JBOSS_HOME/bin/run.sh , if that script is run in the
> > > background.
> >
> > And if you run the java command in the background... otherwise you won't get
> > the PID until the process finishes, when it won't be much use to you.
> >
> 
> Tom,
> Im' incorporating your suggestions ( kill -9 --> kill -15, backticks ...), but I
> wanted to make a comment about this last remark.
> 
> When run.sh starts in the background, you get the following branch of the ps tree
> 
> #pstree |grep java
> |-java---java---19*[java]
> 
> (thats for IBM, with Blackdown or Sun there are 23 at the end)
> and it is this first java process who's pid is captured by $! , which seems
> to work just fine. So It might be enough to just run run.sh in the background.

Think about it... if you have this in run.sh:

1 CP=...
2 java -classpath $CP org.jboss.Main
3 echo $! > /path/to/jboss.pid

then line 3 won't be executed until line 2 has completed... that is, until
jboss has exited, so you need to run java in the background, or you won't have
the PID until it's past time to use it, even if you have run.sh in the
background.

Tom


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-11 Thread Toby Allsopp

Tom Cook wrote:
> 
> On Sat, 10 Feb 2001, you wrote:
[OT ranting]
> 
> Given that we are using this in a startup script, it might not be a good thing
> to use ksh.  I personally (and I think a lot of other people, but I'm not sure)
> put ksh in /usr/local/bin, which is not necessarily available at all points
> during the boot.  I do this because I like to keep all things in /bin
> statically linked, so it's all there when I need to do a bare minimum boot.
> Also, many linux systems don't come with ksh by default.  So you can guarantee
> /bin/sh to be on pretty much _every_ UNIX under the Sun (sorry, couldn't
> resist that pun), but ksh is not as ubiquitous.

Good point. I'd forgotten the whole point of this thread :-) I agree
completely.

> Also ${...} does not work like that on any bash I have installed, but I'm still
> RedHat 6.2 and Tru64 5.0.4, so maybe that's it.

We're talking about dollar parenthesis, not dollar brace. It should
work.

Toby.


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-09 Thread Toby Allsopp

Christopher Albert wrote:

> Phillip,
> 
> Tom agrees with you, and now I do to. I'll change it to a TERM signal in the next
> version.
> While the $() syntax is equivalent to backticks in recent Bash (and I prefer it
> for readability,
> and also becaue the backtick is in a confusing place on my french azerty
> keyboard...), I think
> Tom and Toby are right that it might be better to use backticks for portability.
> I'll change this too.
> I'll post a new version soon before I send it to the jboss-dev list.

My preferred option would be to keep the $(...) syntax and change the 
shell it uses to ksh. I depends how portable you want it. I don't know 
of a UNIX or UNIX-like system that doesn't have ksh. ksh is preferable 
to sh for scripting in almost every way (see the recent /. interview 
with Mr Korn).

Of course, the problem with this is that then you need to change the 
filename from .sh to .ksh so as not to mislead people. A solution to 
this is to leave off the .sh altogther. A better solution is to treat 
the .sh or .ksh as a source file and "compile" it to a file without the 
.sh or .ksh. This compilation step can then fill in the appropriate path 
to the desired shell on the target system for the #! bit at the top.

Or you could just use sh.

Toby.



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-09 Thread Christopher Albert

Tom Cook wrote:

> On Thu, 08 Feb 2001, you wrote:
> > Greetings,
> [snip]
> > Toby suggested using $! to capture the PID of the Java process launched in the
> > background. While I dont think this will work in the init.d/jboss script it will
> > work by adding it to $JBOSS_HOME/bin/run.sh , if that script is run in the
> > background.
>
> And if you run the java command in the background... otherwise you won't get
> the PID until the process finishes, when it won't be much use to you.
>

Tom,
Im' incorporating your suggestions ( kill -9 --> kill -15, backticks ...), but I
wanted to make a comment about this last remark.

When run.sh starts in the background, you get the following branch of the ps tree

#pstree |grep java
|-java---java---19*[java]

(thats for IBM, with Blackdown or Sun there are 23 at the end)
and it is this first java process who's pid is captured by $! , which seems
to work just fine. So It might be enough to just run run.sh in the background.

Thanks,

Chris



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-09 Thread Christopher Albert

Philipp Meier wrote:

> Hello Tom,
>
> On Fri, Feb 09, 2001 at 08:23:54AM +1030, Tom Cook wrote:
> > On Thu, 08 Feb 2001, you wrote:
>
> [snip]
>
> > [snip]
> > > elif [ "$1" = "stop" ] ; then
> > >   shift
> > >   kill -9 $(cat /var/run/jboss.pid)
> >
> > I agree with Toby on this, it is not portable... in fact I can't find a shell
> > in which it works.  This syntax is for environment variables, what you are
> > looking for is
>
> It's bash syntax and means the same as backticks. (At least my linux bash
> and zsh support it).
>
> > kill -9 `cat /var/run/jboss.pid`
> >
> > note that backwards single quotes.
>
> I'm unsure if a kill -9 is the right way to do this?! Jboss has no chance
> to enter it's shutdown hook!
>
> Happy hacking,
> -billy.
>
> --
> Philipp Meier  o-matic GmbH
> Geschäftsführer  Pfarrer-Weiß-Weg 16-18
> Tel.: +49-(0)700-66284236 89077 Ulm
>
> --
> --
> To subscribe:[EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> List Help?:  [EMAIL PROTECTED]

Phillip,

Tom agrees with you, and now I do to. I'll change it to a TERM signal in the next
version.
While the $() syntax is equivalent to backticks in recent Bash (and I prefer it
for readability,
and also becaue the backtick is in a confusing place on my french azerty
keyboard...), I think
Tom and Toby are right that it might be better to use backticks for portability.
I'll change this too.
I'll post a new version soon before I send it to the jboss-dev list.

So far I have tested it with IBM,SUN,and Blackdown jdk1.3 linux ports and all work

fine.

Thanks,
Chris



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-09 Thread Philipp Meier

Hello Tom,

On Fri, Feb 09, 2001 at 08:23:54AM +1030, Tom Cook wrote:
> On Thu, 08 Feb 2001, you wrote:

[snip]

> [snip]
> > elif [ "$1" = "stop" ] ; then
> >   shift
> >   kill -9 $(cat /var/run/jboss.pid)
> 
> I agree with Toby on this, it is not portable... in fact I can't find a shell
> in which it works.  This syntax is for environment variables, what you are
> looking for is

It's bash syntax and means the same as backticks. (At least my linux bash
and zsh support it).

> kill -9 `cat /var/run/jboss.pid`
> 
> note that backwards single quotes.

I'm unsure if a kill -9 is the right way to do this?! Jboss has no chance
to enter it's shutdown hook!

Happy hacking,
-billy.

-- 
Philipp Meier  o-matic GmbH
Geschäftsführer  Pfarrer-Weiß-Weg 16-18
Tel.: +49-(0)700-66284236 89077 Ulm


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-08 Thread Tom Cook

On Thu, 08 Feb 2001, you wrote:
> Greetings,
[snip]
> Toby suggested using $! to capture the PID of the Java process launched in the
> background. While I dont think this will work in the init.d/jboss script it will
> work by adding it to $JBOSS_HOME/bin/run.sh , if that script is run in the
> background.

And if you run the java command in the background... otherwise you won't get
the PID until the process finishes, when it won't be much use to you.

> Tom pointed out that jboss does its own logging and thus it is redundant to
create > an additional log file. However, I believe it is best , when launching
jboss as an > init daemon, to run it in the background. This avoids potential
hang problems at > boot time, I think, since daemon wont get a return signal
from run.sh if it starts > it in the foreground.

I still thing it's bad to have two files logging the same thing.  If you want
to start it in the background, redirect to /dev/null; it's what it's there for.

> Finally I propose that run.sh do a test for the type of JDK, since it seems
that > SUN jdk1.3's java recognizes the "-server" switch, but IBM's does not.

Agreed.  Compaq's JDK also does not support this switch.

[snip]
> elif [ "$1" = "stop" ] ; then
>   shift
>   kill -9 $(cat /var/run/jboss.pid)

I agree with Toby on this, it is not portable... in fact I can't find a shell
in which it works.  This syntax is for environment variables, what you are
looking for is

kill -9 `cat /var/run/jboss.pid`

note that backwards single quotes.

Other than that, it's looking very handy indeed.

Tom


[snip]



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-08 Thread Toby Allsopp

Christopher Albert wrote:
> 
> elif [ "$1" = "stop" ] ; then
>   shift
>   kill -9 $(cat /var/run/jboss.pid)

Why SIGKILL? Seems a bit harsh.

Also, I'm not sure that $(...) is sh syntax. I suspect it was added by
ksh and adopted by bash. You're almost ceratinly safe on Linux, though.

Toby.


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




RE: [jBoss-User] Starting jBoss as a service on Linux

2001-02-08 Thread marc fleury

Chris when you think you are done, please post it on jboss-dev

I will actually use it on GUNS :)

marc


|-Original Message-
|From: [EMAIL PROTECTED]
|[mailto:[EMAIL PROTECTED]]On Behalf Of Christopher Albert
|Sent: Thursday, February 08, 2001 4:25 AM
|To: jBoss
|Subject: Re: [jBoss-User] Starting jBoss as a service on Linux
|
|
|Greetings,
|
|I am continuing to work on the Linux jboss init script,
|incorporating suggestions,
|and when we reach some consensus I'd be happy to write up a little
|section for the
|FAQ on this subject.
|
|Toby suggested using $! to capture the PID of the Java process
|launched in the
|background. While I dont think this will work in the init.d/jboss
|script it will
|work by adding it to $JBOSS_HOME/bin/run.sh , if that script is run in the
|background.
|
|Tom pointed out that jboss does its own logging and thus it is
|redundant to create
|an additional log file. However, I believe it is best , when
|launching jboss as an
|init daemon, to run it in the background. This avoids potential
|hang problems at
|boot time, I think, since daemon wont get a return signal from
|run.sh if it starts
|it in the foreground.
|
|Finally I propose that run.sh do a test for the type of JDK, since
|it seems that
|SUN jdk1.3's java recognizes the "-server" switch, but IBM's does not.
|
|
|Thus, for "run.sh" , ommitting most details, including the jetty and tomcat
|options,
|I suggest something along the following lines, where the user can
|choose to run
|in the foreground or background.
|
|###
|#!/bin/sh
|#
|...
|# Shell script to start and stop the server
|...
|if [ "$JAVACMD" = "" ] ; then
|if [ -d ${JAVA_HOME}/lib/i386 ] ; then
|   # We are probably in a SUN environment
|   JAVACMD="$JAVA_HOME/bin/java -server"
|else
|   # it is probably Big Blue
|   JAVACMD=$JAVA_HOME/bin/java
|fi
|fi
|
|if [ "$1" = "start" ] ; then
|  shift
|  $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main "$@"  2>&1 &
|  echo $! > /var/run/jboss.pid
|
|elif [ "$1" = "stop" ] ; then
|  shift
|  kill -9 $(cat /var/run/jboss.pid)
|
|elif [ "$1" = "run" ] ; then
|  shift
|  $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH   org.jboss.Main "$@"
|
|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
|
|##
|
|Given this modification, starting from Matthew's init script,
|incorporating some
|of Tobys and Tom's suggestions, I propose
|#!/bin/sh
|#
|# Startup script for JBOSS, the J2EE EJB Server
|#
|# chkconfig: 345 85 15
|# description: Jboss is an EJB Server
|# processname: jboss
|# pidfile: /var/run/jboss.pid
|# config: ${JBOSS_HOME}/conf/default/jboss.conf
|# logfile: ${JBOSS_HOME}/log/server.log
|#
|#
|# version 1.1 -
|#
|
|# Source function library.
|. /etc/rc.d/init.d/functions
|
|export JAVA_HOME=/opt/IBMJava2-13
|export JBOSS_HOME=/opt/jBoss-2.0_FINAL
|export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
|
|RETVAL=0
|
|# See how we were called.
|case "$1" in
|  start)
| cd $JBOSS_HOME/bin
|echo -n "Starting jboss daemon: "
|daemon $JBOSS_HOME/bin/run.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
|;;
|  *)
|echo "Usage: $0 {start|stop|restart}"
|exit 1
|esac
|exit $RETVAL
|
|###""
|
|Thank you all for your comments. I hope I'm making progress.
|
|Chris
|
|
|
|
|--
|--
|To subscribe:[EMAIL PROTECTED]
|To unsubscribe:  [EMAIL PROTECTED]
|List Help?:  [EMAIL PROTECTED]
|



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-08 Thread Christopher Albert

Greetings,

I am continuing to work on the Linux jboss init script, incorporating suggestions,
and when we reach some consensus I'd be happy to write up a little section for the
FAQ on this subject.

Toby suggested using $! to capture the PID of the Java process launched in the
background. While I dont think this will work in the init.d/jboss script it will
work by adding it to $JBOSS_HOME/bin/run.sh , if that script is run in the
background.

Tom pointed out that jboss does its own logging and thus it is redundant to create
an additional log file. However, I believe it is best , when launching jboss as an
init daemon, to run it in the background. This avoids potential hang problems at
boot time, I think, since daemon wont get a return signal from run.sh if it starts
it in the foreground.

Finally I propose that run.sh do a test for the type of JDK, since it seems that
SUN jdk1.3's java recognizes the "-server" switch, but IBM's does not.


Thus, for "run.sh" , ommitting most details, including the jetty and tomcat
options,
I suggest something along the following lines, where the user can choose to run
in the foreground or background.

###
#!/bin/sh
#
...
# Shell script to start and stop the server
...
if [ "$JAVACMD" = "" ] ; then
if [ -d ${JAVA_HOME}/lib/i386 ] ; then
   # We are probably in a SUN environment
   JAVACMD="$JAVA_HOME/bin/java -server"
else
   # it is probably Big Blue
   JAVACMD=$JAVA_HOME/bin/java
fi
fi

if [ "$1" = "start" ] ; then
  shift
  $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH org.jboss.Main "$@"  2>&1 &
  echo $! > /var/run/jboss.pid

elif [ "$1" = "stop" ] ; then
  shift
  kill -9 $(cat /var/run/jboss.pid)

elif [ "$1" = "run" ] ; then
  shift
  $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH   org.jboss.Main "$@"

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

##

Given this modification, starting from Matthew's init script, incorporating some
of Tobys and Tom's suggestions, I propose
#!/bin/sh
#
# Startup script for JBOSS, the J2EE EJB Server
#
# chkconfig: 345 85 15
# description: Jboss is an EJB Server
# processname: jboss
# pidfile: /var/run/jboss.pid
# config: ${JBOSS_HOME}/conf/default/jboss.conf
# logfile: ${JBOSS_HOME}/log/server.log
#
#
# version 1.1 -
#

# Source function library.
. /etc/rc.d/init.d/functions

export JAVA_HOME=/opt/IBMJava2-13
export JBOSS_HOME=/opt/jBoss-2.0_FINAL
export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

RETVAL=0

# See how we were called.
case "$1" in
  start)
 cd $JBOSS_HOME/bin
echo -n "Starting jboss daemon: "
daemon $JBOSS_HOME/bin/run.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
;;
  *)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL

###""

Thank you all for your comments. I hope I'm making progress.

Chris




--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-07 Thread Tom Cook

On Wed, 07 Feb 2001, you wrote:
> Greetings,
> 
> I have modified a bit Mathew Drew's init script , adding
[snip]
> 2. I run this in the background, so i have put the start script "go.sh"
instead > 
> of run.sh , which is like run except it has the following line to startup
> 
> $JAVACMD $JBOSS_OPTS -classpath $CLASSPATH  \
> org.jboss.Main "$@"  > /var/log/jboss.log 2>&1 &

I think this is a bad move.  JBoss already logs all this stuff to a file, so
that should be used if people want file logging.  If they don't want it pouring
logging all over their console as well, then they should configure JBoss so it
doesn't do any console logging.

Tom


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-07 Thread Toby Allsopp

Christopher Albert wrote:
> 
> 3. A hack to pull out and kill the pid of the first java process with PPID of 1
> that contains jboss (for org.jboss.Main) on the command line.
> This is the best I could do to stop the process, since I dont understand how to
> get the stop.jar in $JBOSS_HOME/client/ to work.

Tip: $! is the PID of the process just launched in the background.

Toby.


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-07 Thread Christopher Albert

Greetings,

I have modified a bit Mathew Drew's init script , adding

1. A line for chkconfig which will start and stop the service at
run levels 2,3,4,and 5 with start priority 85 and kill priority 15.
Thus way all you need to do is run
$ chkconfig --add jboss
once you have put the script in /etc/rc.d/init.d to get the links set up
correctly.

2. I run this in the background, so i have put the start script "go.sh" instead

of run.sh , which is like run except it has the following line to startup

$JAVACMD $JBOSS_OPTS -classpath $CLASSPATH  \
org.jboss.Main "$@"  > /var/log/jboss.log 2>&1 &

Where I set $JBOSS_OPTS to "-server" if the JVM is sun, and empty
if it is IBM since the java of IBM does not recognize this switch.

3. A hack to pull out and kill the pid of the first java process with PPID of 1

that contains jboss (for org.jboss.Main) on the command line.

This is the best I could do to stop the process, since I dont understand how to

get the stop.jar in $JBOSS_HOME/client/ to work.

Comments appreciated,

Chris


#!/bin/sh
#
# Startup script for jboss
#
# chkconfig: 2345 85 15
# description: Jboss is an EJB Server
# processname: jboss
# pidfile: /var/run/jboss.pid
# config: ${JBOSS_HOME}/conf/default/jboss.conf
#
#
# version 1.1 -
#

# Source function library.
. /etc/rc.d/init.d/functions

export JAVA_HOME=/opt/jdk
export JBOSS_HOME=/usr/local/jboss
export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

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: "
kill -9 $(ps lx|grep -v grep|grep jboss|awk '{ if ( $4 == 1 ) print

$3}')
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/jboss
;;
  restart)
echo -n "Restarting jboss daemon: "
$0 stop
sleep 2
$0 start
;;
  *)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-06 Thread Tom Cook

On Tue, 06 Feb 2001, you wrote:
[snip]
> I haven't tried the port 8082 solution
> yet, but I would prefer to find a java solution.

And, as many point out, it's not very secure.  Could HTTP authentication be
added to this service?  Or is that not possible because the source is not
accessible?

> I have not found the "
> stop.jar" .  Can someone shed some light on how to initiate jboss
> shutdown?

My jboss-PRE-2.1, build from cvs of 19 Jan,  has a 'stop.jar' in
JBOSS_HOME/client.  This also really needs to be secured in some way before
it's very useful, though.

Tom


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




RE: [jBoss-User] Starting jBoss as a service on Linux

2001-02-06 Thread Michael G. Drew

I believe it does bind to all nics.  I use ipchains to control access to
this port based on the source ip.  I've got it locked down so that only my
pc and localhost can connect to that port.  Another solution is to not run
the service.  There is a lot of sensitive info that can be discovered by
snooping around on port 8082, some of which (in my case anyway) include
database passwords.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Scott Warren
Sent: Monday, February 05, 2001 5:31 PM
To: jBoss
Subject: RE: [jBoss-User] Starting jBoss as a service on Linux


Does the Simple Web Server on 8082 bind to all NIC's cause I see this as a
possible security problem. Obviously there is no Authentication to shutdown
or am I missing the point ??
Regards


Scott Warren
Lead Internet Technologies Developer

-
Phone: +61 3 5222 6240
mailto:  [EMAIL PROTECTED]
web: www.advancedresource.com.au

-


-Original Message-
From: Tom Cook [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 6 February 2001 10:02 AM
To: jBoss
Subject: RE: [jBoss-User] Starting jBoss as a service on Linux


Why use a PID file and kill when you there is a 'stop.jar' (admittedly this
has
a hardcoded name which doesn't seem to be correct, though this may have been
fixed) or you can just connect to port 8082 and stuff a string like:
GET
/InvokeAction//DefaultDomain%3Atype%3DShutdown/action=shutdown?shutdown=true
HTTP/1.0
into the socket?
Tom
On Tue, 06 Feb 2001, you wrote:
> You have to create it.  Here's an example of what I have used on RedHat
6.2.
> Put this in a file called /etc/rc.d/init.d/jboss and change all the
> NAMEOFSERVER's to jboss.  You'll have to create a stopServer.sh script to
> kill it (just catch the pid to a file in run.sh and then kill -9 $(cat
> /path/to/pid/file) ).  Then you must create symbolic links to this file in
> each of the rc?.d directories under /etc/rc.d.  Startup scripts start with
S
> and kill scripts start with K.  Take a look at cron or ipchains for an
> example.  Again I haven't tried setting this up explicity for jboss yet,
but
> it works for another pure java server I wrote.
>
> #! /bin/sh
> #
> # NAMEOFSERVER -  Start and Stop NAMEOFSERVER daemon
> #
> # description: bla bla bla bla
> #
>
> # Source function library.
> . /etc/rc.d/init.d/functions
> eexport PATH=$PATH:path/to/server:/usr/java/jdk1.3/bin
> cd /path/to/server
>
> RETVAL=0
>
> # See how we were called.
> case "$1" in
>   start)
> echo -n "Starting NAMEOFSERVER daemon: "
> daemon /path/to/server/run.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> ;;
>   stop)
> echo -n "Stopping NAMEOFSERVER daemon: "
> daemon /path/to/server/stopServer.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> ;;
>   restart)
> echo -n "Stopping NAMEOFSERVER daemon: "
> deamon /path/to/server/stopServer.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> echo -n "Starting NAMEOFSERVER daemon: "
> deamon /path/to/server/run.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> ;;
>   *)
>     echo "Usage: NAMEOFSERVER {start|stop|restart}"
> exit 1
> esac
> exit $RETVAL
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Tim Yates
> > Sent: Monday, February 05, 2001 10:03 AM
> > To: jBoss
> > Subject: Re: [jBoss-User] Starting jBoss as a service on Linux
> >
> >
> > > have you tried putting
> > > cd $JBOSS_HOME/bin
> > > at the top of your init.d script?
> > >
> > > I haven't setup jboss this way yet, but I have another pure java
server
> > that
> > > I just recently had to do the same thing for.
> > >
> >
> > Where can I grab an init.d script and info on how to install it...?
> >
> > I am tired of searching for "run.sh" in the ps -A list and finding the
> > closest java instance to that ;-)
> >
> > Hacky, hacky, hacky!!!
> >
> > Tim.
> >
> >
> >
> > --
> > --
> > To subscribe:[EMAIL PROTECTED]
> > To uns

Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-06 Thread Tim Yates


- Original Message -
From: Tom Cook <[EMAIL PROTECTED]>

> Why use a PID file and kill when you there is a 'stop.jar' (admittedly
this has
> a hardcoded name which doesn't seem to be correct, though this may have
been
> fixed) or you can just connect to port 8082 and stuff a string like:
>
> GET
/InvokeAction//DefaultDomain%3Atype%3DShutdown/action=shutdown?shutdown=true
HTTP/1.0
>

Yeah, but I have the Webserver on 8082 turned off for exactly this reason...

We don't want just anyone examining our jBoss installation, and then
shutting it down...

Tim.



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-06 Thread Christopher Albert

Using an init script that cd's to $JBOOS_HOME/bin will indeed start
the service as desired. However, on the linux I have tried sending a
kill signal
to the initiating script will not stop the java processes spawned by the
start
script, as suggested for example in the FAQ. In addition, since I prefer
to have jboss run in the background, I have to target one of the java
process launched to cleanly shutdown jboss . It seems that one needs to
send a kill signal (1, 9 and 15 all work) to any of the java processus
launched by jboss at startup. I haven't tried the port 8082 solution
yet, but I would prefer to find a java solution. I have not found the "
stop.jar" .  Can someone shed some light on how to initiate jboss
shutdown?

Chris

>
>
> Does the Simple Web Server on 8082 bind to all NIC's cause I see this
> as a possible security problem. Obviously there is no Authentication
> to shutdown or am I missing the point ??
>
> Regards
>
> Scott Warren
> Lead Internet Technologies Developer
>
> 
>
> Phone: +61 3 5222 6240
> mailto:  [EMAIL PROTECTED]
> web: www.advancedresource.com.au
>
> 
>
> -Original Message-
> From: Tom Cook [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 6 February 2001 10:02 AM
> To: jBoss
> Subject: RE: [jBoss-User] Starting jBoss as a service on Linux
>
> Why use a PID file and kill when you there is a 'stop.jar' (admittedly
> this has
> a hardcoded name which doesn't seem to be correct, though this may
> have been
> fixed) or you can just connect to port 8082 and stuff a string like:
>
> GET
> /InvokeAction//DefaultDomain%3Atype%3DShutdown/action=shutdown?shutdown=true
> HTTP/1.0
>
> into the socket?
>
> Tom
>
> On Tue, 06 Feb 2001, you wrote:
> > You have to create it.  Here's an example of what I have used on
> RedHat 6.2.
> > Put this in a file called /etc/rc.d/init.d/jboss and change all the
> > NAMEOFSERVER's to jboss.  You'll have to create a stopServer.sh
> script to
> > kill it (just catch the pid to a file in run.sh and then kill -9
> $(cat
> > /path/to/pid/file) ).  Then you must create symbolic links to this
> file in
> > each of the rc?.d directories under /etc/rc.d.  Startup scripts
> start with S
> > and kill scripts start with K.  Take a look at cron or ipchains for
> an
> > example.  Again I haven't tried setting this up explicity for jboss
> yet, but
> > it works for another pure java server I wrote.
> >
> > #! /bin/sh
> > #
> > # NAMEOFSERVER -  Start and Stop NAMEOFSERVER daemon
> > #
> > # description: bla bla bla bla
> > #
> >
> > # Source function library.
> > . /etc/rc.d/init.d/functions
> > eexport PATH=$PATH:path/to/server:/usr/java/jdk1.3/bin
> > cd /path/to/server
> >
> > RETVAL=0
> >
> > # See how we were called.
> > case "$1" in
> >   start)
> > echo -n "Starting NAMEOFSERVER daemon: "
> > daemon /path/to/server/run.sh
> > RETVAL=$?
> > echo
> > [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> > ;;
> >   stop)
> > echo -n "Stopping NAMEOFSERVER daemon: "
> > daemon /path/to/server/stopServer.sh
> > RETVAL=$?
> > echo
> > [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> > ;;
> >   restart)
> > echo -n "Stopping NAMEOFSERVER daemon: "
> > deamon /path/to/server/stopServer.sh
> > RETVAL=$?
> > echo
> > [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> >     echo -n "Starting NAMEOFSERVER daemon: "
> > deamon /path/to/server/run.sh
> > RETVAL=$?
> > echo
> > [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> > ;;
> >   *)
> > echo "Usage: NAMEOFSERVER {start|stop|restart}"
> > exit 1
> > esac
> > exit $RETVAL
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED]]On Behalf Of Tim Yates
> > > Sent: Monday, February 05, 2001 10:03 AM
> > > To: jBoss
> > > Subject: Re: [jBoss-User] Starting jBoss as a service on Linux
> > >
> > >
> > > > have you tried putting
> > > > cd $JBOSS_HOME/bin
> > > > at the top of your init.d script?
> > > >
> > > > I haven't setup jboss this way yet, but I have another pure java
> server
> > > that
> > > > I just recently had to do the same thing for.
> > > >
> > >
> > > Where can I grab an init.d script and info on how to install
> it...?
> > >
> > > I am tired of searching for "run.sh" in the ps -A list and finding
> the
> > > closest java instance to that ;-)
> > >
> > > Hacky, hacky, hacky!!!
> > >
> > > Tim.
> > >



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




RE: [jBoss-User] Starting jBoss as a service on Linux

2001-02-05 Thread Scott Warren
Title: RE: [jBoss-User] Starting jBoss as a service on Linux





Does the Simple Web Server on 8082 bind to all NIC's cause I see this as a possible security problem. Obviously there is no Authentication to shutdown or am I missing the point ??

Regards



Scott Warren
Lead Internet Technologies Developer
-
Phone: +61 3 5222 6240
mailto:  [EMAIL PROTECTED]
web: www.advancedresource.com.au
-



-Original Message-
From: Tom Cook [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 6 February 2001 10:02 AM
To: jBoss
Subject: RE: [jBoss-User] Starting jBoss as a service on Linux



Why use a PID file and kill when you there is a 'stop.jar' (admittedly this has
a hardcoded name which doesn't seem to be correct, though this may have been
fixed) or you can just connect to port 8082 and stuff a string like:


GET /InvokeAction//DefaultDomain%3Atype%3DShutdown/action=shutdown?shutdown=true HTTP/1.0


into the socket?


Tom


On Tue, 06 Feb 2001, you wrote:
> You have to create it.  Here's an example of what I have used on RedHat 6.2.
> Put this in a file called /etc/rc.d/init.d/jboss and change all the
> NAMEOFSERVER's to jboss.  You'll have to create a stopServer.sh script to
> kill it (just catch the pid to a file in run.sh and then kill -9 $(cat
> /path/to/pid/file) ).  Then you must create symbolic links to this file in
> each of the rc?.d directories under /etc/rc.d.  Startup scripts start with S
> and kill scripts start with K.  Take a look at cron or ipchains for an
> example.  Again I haven't tried setting this up explicity for jboss yet, but
> it works for another pure java server I wrote.
> 
> #! /bin/sh
> #
> # NAMEOFSERVER -  Start and Stop NAMEOFSERVER daemon
> #
> # description: bla bla bla bla
> #
> 
> # Source function library.
> . /etc/rc.d/init.d/functions
> eexport PATH=$PATH:path/to/server:/usr/java/jdk1.3/bin
> cd /path/to/server
> 
> RETVAL=0
> 
> # See how we were called.
> case "$1" in
>   start)
> echo -n "Starting NAMEOFSERVER daemon: "
> daemon /path/to/server/run.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> ;;
>   stop)
> echo -n "Stopping NAMEOFSERVER daemon: "
> daemon /path/to/server/stopServer.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> ;;
>   restart)
> echo -n "Stopping NAMEOFSERVER daemon: "
> deamon /path/to/server/stopServer.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> echo -n "Starting NAMEOFSERVER daemon: "
> deamon /path/to/server/run.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> ;;
>   *)
> echo "Usage: NAMEOFSERVER {start|stop|restart}"
> exit 1
> esac
> exit $RETVAL
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Tim Yates
> > Sent: Monday, February 05, 2001 10:03 AM
> > To: jBoss
> > Subject: Re: [jBoss-User] Starting jBoss as a service on Linux
> >
> >
> > > have you tried putting
> > > cd $JBOSS_HOME/bin
> > > at the top of your init.d script?
> > >
> > > I haven't setup jboss this way yet, but I have another pure java server
> > that
> > > I just recently had to do the same thing for.
> > >
> >
> > Where can I grab an init.d script and info on how to install it...?
> >
> > I am tired of searching for "run.sh" in the ps -A list and finding the
> > closest java instance to that ;-)
> >
> > Hacky, hacky, hacky!!!
> >
> > Tim.
> >
> >
> >
> > --
> > --
> > To subscribe:    [EMAIL PROTECTED]
> > To unsubscribe:  [EMAIL PROTECTED]
> > List Help?:  [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> --
> --
> To subscribe:    [EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> List Help?:  [EMAIL PROTECTED]



--
--
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]





RE: [jBoss-User] Starting jBoss as a service on Linux

2001-02-05 Thread Tom Cook

Why use a PID file and kill when you there is a 'stop.jar' (admittedly this has
a hardcoded name which doesn't seem to be correct, though this may have been
fixed) or you can just connect to port 8082 and stuff a string like:

GET /InvokeAction//DefaultDomain%3Atype%3DShutdown/action=shutdown?shutdown=true 
HTTP/1.0

into the socket?

Tom

On Tue, 06 Feb 2001, you wrote:
> You have to create it.  Here's an example of what I have used on RedHat 6.2.
> Put this in a file called /etc/rc.d/init.d/jboss and change all the
> NAMEOFSERVER's to jboss.  You'll have to create a stopServer.sh script to
> kill it (just catch the pid to a file in run.sh and then kill -9 $(cat
> /path/to/pid/file) ).  Then you must create symbolic links to this file in
> each of the rc?.d directories under /etc/rc.d.  Startup scripts start with S
> and kill scripts start with K.  Take a look at cron or ipchains for an
> example.  Again I haven't tried setting this up explicity for jboss yet, but
> it works for another pure java server I wrote.
> 
> #! /bin/sh
> #
> # NAMEOFSERVER -  Start and Stop NAMEOFSERVER daemon
> #
> # description: bla bla bla bla
> #
> 
> # Source function library.
> . /etc/rc.d/init.d/functions
> eexport PATH=$PATH:path/to/server:/usr/java/jdk1.3/bin
> cd /path/to/server
> 
> RETVAL=0
> 
> # See how we were called.
> case "$1" in
>   start)
> echo -n "Starting NAMEOFSERVER daemon: "
> daemon /path/to/server/run.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> ;;
>   stop)
> echo -n "Stopping NAMEOFSERVER daemon: "
> daemon /path/to/server/stopServer.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> ;;
>   restart)
> echo -n "Stopping NAMEOFSERVER daemon: "
> deamon /path/to/server/stopServer.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
> echo -n "Starting NAMEOFSERVER daemon: "
> deamon /path/to/server/run.sh
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
> ;;
>   *)
> echo "Usage: NAMEOFSERVER {start|stop|restart}"
> exit 1
> esac
> exit $RETVAL
> 
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Tim Yates
> > Sent: Monday, February 05, 2001 10:03 AM
> > To: jBoss
> > Subject: Re: [jBoss-User] Starting jBoss as a service on Linux
> >
> >
> > > have you tried putting
> > > cd $JBOSS_HOME/bin
> > > at the top of your init.d script?
> > >
> > > I haven't setup jboss this way yet, but I have another pure java server
> > that
> > > I just recently had to do the same thing for.
> > >
> >
> > Where can I grab an init.d script and info on how to install it...?
> >
> > I am tired of searching for "run.sh" in the ps -A list and finding the
> > closest java instance to that ;-)
> >
> > Hacky, hacky, hacky!!!
> >
> > Tim.
> >
> >
> >
> > --
> > --
> > To subscribe:[EMAIL PROTECTED]
> > To unsubscribe:  [EMAIL PROTECTED]
> > List Help?:  [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> --
> --
> To subscribe:[EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> List Help?:  [EMAIL PROTECTED]


--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




RE: [jBoss-User] Starting jBoss as a service on Linux

2001-02-05 Thread Michael G. Drew

You have to create it.  Here's an example of what I have used on RedHat 6.2.
Put this in a file called /etc/rc.d/init.d/jboss and change all the
NAMEOFSERVER's to jboss.  You'll have to create a stopServer.sh script to
kill it (just catch the pid to a file in run.sh and then kill -9 $(cat
/path/to/pid/file) ).  Then you must create symbolic links to this file in
each of the rc?.d directories under /etc/rc.d.  Startup scripts start with S
and kill scripts start with K.  Take a look at cron or ipchains for an
example.  Again I haven't tried setting this up explicity for jboss yet, but
it works for another pure java server I wrote.

#! /bin/sh
#
# NAMEOFSERVER -  Start and Stop NAMEOFSERVER daemon
#
# description: bla bla bla bla
#

# Source function library.
. /etc/rc.d/init.d/functions
export PATH=$PATH:path/to/server:/usr/java/jdk1.3/bin
cd /path/to/server

RETVAL=0

# See how we were called.
case "$1" in
  start)
echo -n "Starting NAMEOFSERVER daemon: "
daemon /path/to/server/run.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
;;
  stop)
echo -n "Stopping NAMEOFSERVER daemon: "
daemon /path/to/server/stopServer.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
;;
  restart)
echo -n "Stopping NAMEOFSERVER daemon: "
deamon /path/to/server/stopServer.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/NAMEOFSERVER
echo -n "Starting NAMEOFSERVER daemon: "
deamon /path/to/server/run.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/NAMEOFSERVER
;;
  *)
echo "Usage: NAMEOFSERVER {start|stop|restart}"
exit 1
esac
exit $RETVAL

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Tim Yates
> Sent: Monday, February 05, 2001 10:03 AM
> To: jBoss
> Subject: Re: [jBoss-User] Starting jBoss as a service on Linux
>
>
> > have you tried putting
> > cd $JBOSS_HOME/bin
> > at the top of your init.d script?
> >
> > I haven't setup jboss this way yet, but I have another pure java server
> that
> > I just recently had to do the same thing for.
> >
>
> Where can I grab an init.d script and info on how to install it...?
>
> I am tired of searching for "run.sh" in the ps -A list and finding the
> closest java instance to that ;-)
>
> Hacky, hacky, hacky!!!
>
> Tim.
>
>
>
> --
> --
> To subscribe:[EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> List Help?:  [EMAIL PROTECTED]
>
>



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




Re: [jBoss-User] Starting jBoss as a service on Linux

2001-02-05 Thread Tim Yates

> have you tried putting
> cd $JBOSS_HOME/bin
> at the top of your init.d script?
>
> I haven't setup jboss this way yet, but I have another pure java server
that
> I just recently had to do the same thing for.
>

Where can I grab an init.d script and info on how to install it...?

I am tired of searching for "run.sh" in the ps -A list and finding the
closest java instance to that ;-)

Hacky, hacky, hacky!!!

Tim.



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




RE: [jBoss-User] Starting jBoss as a service on Linux

2001-02-05 Thread Michael G. Drew

have you tried putting
cd $JBOSS_HOME/bin
at the top of your init.d script?

I haven't setup jboss this way yet, but I have another pure java server that
I just recently had to do the same thing for.

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Christopher Albert
> Sent: Monday, February 05, 2001 8:19 AM
> To: jBoss
> Subject: [jBoss-User] Starting jBoss as a service on Linux
>
>
> Greetings,
>
> I've got jBoss-2.0_FINAL up and running on my linux box, and now I want
> to integate it as a service that gets started at boot time in the
> standard way, that is from a script in /etc/rc.d/init.d on my RH system.
> Once I do that, I plan to package it up in an rpm.
> However, I am having difficulty using the standard sourced functions
> like "daemon" since it seems that jBoss needs to be run from its local
> bin directory.
> The problem seems to lie in org.jboss.Main , lines 107,108
>
> ...
>
> // Add configuration directory to MLet
>  URL confDirectory = new
> File("../conf/"+confName).getCanonicalFile().toURL();
> ...
> Where the relative path to the config file is coded in.
>
> Has anyone succeded in getting jBoss running as a daemon in the standard
> linux way without recoding this part of Main.
>
> Chris
>
>
>
> --
> --
> To subscribe:[EMAIL PROTECTED]
> To unsubscribe:  [EMAIL PROTECTED]
> List Help?:  [EMAIL PROTECTED]
>
>



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]




[jBoss-User] Starting jBoss as a service on Linux

2001-02-05 Thread Christopher Albert

Greetings,

I've got jBoss-2.0_FINAL up and running on my linux box, and now I want
to integate it as a service that gets started at boot time in the
standard way, that is from a script in /etc/rc.d/init.d on my RH system.
Once I do that, I plan to package it up in an rpm.
However, I am having difficulty using the standard sourced functions
like "daemon" since it seems that jBoss needs to be run from its local
bin directory.
The problem seems to lie in org.jboss.Main , lines 107,108

...

// Add configuration directory to MLet
 URL confDirectory = new
File("../conf/"+confName).getCanonicalFile().toURL();
...
Where the relative path to the config file is coded in.

Has anyone succeded in getting jBoss running as a daemon in the standard
linux way without recoding this part of Main.

Chris



--
--
To subscribe:[EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
List Help?:  [EMAIL PROTECTED]