users@glassfish.java.net

Re: how to start glassfish as windows service or Linux daemon?

From: kedar <Kedar.Mhaswade_at_Sun.COM>
Date: Thu, 16 Nov 2006 08:36:26 -0800

Hi Wouter Van Reeven,

Are you willing to contribute this script to GlassFish?
If yes, we can get it integrated and that way we will have
a defined support for Platform integration. Please see the
plan at:
http://www.glassfishwiki.org/gfwiki/attach/GlassFishV2AdminRelatedOnePagers/admin-fs.html#misc

This is not happening for GlassFish V2 at the moment.

Take a look at the "asadmin create-service" command and let us
know what you think. It is available only for Solaris 10 at the
moment and the plan is to extend it to other platforms. Yet another
reason to use OpenSolaris!

See:
http://blogs.sun.com/bloggerkedar/entry/app_server_and_solaris_10
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1308

Regards,
Kedar

Wouter van Reeven wrote:
> Hi Legolas,
>
> On Thu, Nov 16, 2006 at 02:20:36PM +0330, legolas wood wrote:
>
>> Thank you for reading my post
>> how we can start glassfish as a windows service or Linux daemon ?
>> indeed first we need to register them as a service and then register the
>> service
>>
>
> I don't know about Windows, but on Linux I use the script included below. I have
> put it in the /etc/init.d directory. Please note that I have installed glassfish
> in the /usr/local/glassfish directory and that all files and directories are
> owned by the user glassfish in the group glassfish. I also created a log
> directory in /usr/local/glassfish to redirect any system messages to.
>
> Preferably I would create a package (Debian in my case) to install it in a
> system-specific way. But that is future music for me.
>
> Modify the script at will (and your own risk ;-)
>
>
> HTH, Wouter van Reeven
>
> =========================
> #!/bin/sh
> # Glassfish Startup Script
>
> GLASSFISH_HOME=/usr/local/glassfish; export GLASSFISH_HOME
> GLASSFISH_OWNER=glassfish; export GLASSFISH_OWNER
>
> start() {
> echo -n "Starting Glassfish: "
> echo "Starting Glassfish at `date`" >>
> $GLASSFISH_HOME/log/start_stop.log
> su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1" >> $GLASSFISH_HOME/log/start_stop.log
> sleep 2
> echo "done"
> }
> stop() {
> echo -n "Stopping Glassfish: "
> echo "Stopping Glassfish at `date`" >>
> $GLASSFISH_HOME/log/start_stop.log
> su $GLASSFISH_OWNER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1" >> $GLASSFISH_HOME/log/start_stop.log
> echo "done"
> }
>
> # See how we were called.
> case "$1" in
> start)
> start
> ;;
> stop)
> stop
> ;;
> restart)
> stop
> start
> ;;
> *)
> echo $"Usage: glassfish {start|stop|restart}"
> exit
> esac
> =========================
>
>