How to auto start glassfish server

H

1. Create file name ‘glassfish’ and edit file

sudo nano /etc/init.d/glassfish

2. Write the lines below into the file and save it

#! /bin/sh

#to prevent some possible problems
export AS_JAVA=jdk path

GLASSFISHPATH= glashfish bin path

case "$1" in
start)
echo "starting glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo "stopping glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo $"usage: $0 {start|stop|restart}"
exit 3
;;
esac
:

3. Make the init script file executable

sudo chmod a+x /etc/init.d/glassfish

4. Configure Glassfish for autostart on ubuntu boot

sudo update-rc.d glassfish defaults

6. Start, stop or restart Glassfish server

Start

service glassfish start

Stop

service glassfish stop

Restart

service glassfish restart

About the author

Adarsh Vengarathodi
By Adarsh Vengarathodi

Your sidebar area is currently empty. Hurry up and add some widgets.