Last active
January 28, 2020 10:02
-
-
Save AmrAbdeen/642183789c0f0ba91613 to your computer and use it in GitHub Desktop.
How to Run GlassFish V4.1 as a Service on Linux Ubuntu/Debian
source: https://blogs.oracle.com/foo/entry/how_to_run_glassfish_v3
http://computingwithjasper.blogspot.com.eg/2008/01/installing-glassfish-2-on-ubuntu-710.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We already support running GlassFish V3 as a service on Solaris 10 and Windows platforms (see my blog). I have been investigating how to provide support for automatically starting GlassFish V3 as a service on Linux. Of course before I can hope to do that -- I must be able to set it up manually. In this blog I will take you through the manual steps needed to run GlassFish V3 as a service on Linux. | |
This procedure was worked out on my Linux system which happens to be Ubuntu. Other flavors of Linux may have slightly different procedures. | |
One decision you need to make right up front is what Linux user should "own" GlassFish V3. Typically root is used as the owner. If you choose root as the user you get the advantage that you can use ports < 1024 without complex configuration changes to the system. For this blog I used root. | |
Here are the steps -- the file named "glassfish" in step 4 is the simple init script which appears at the end of this blog. | |
Install JDK 6 if needed | |
Have root install GlassFish like so: | |
cd /opt | |
wget http://download.java.net/glassfish/v3/release/glassfish-v3.zip | |
unzip glassfish-v3.zip | |
rm glassfish-v3.zip | |
cd /etc/init.d | |
cp glassfish . | |
update-rc.d glassfish defaults | |
OPTIONAL /etc/init.d/glassfish start | |
OPTIONAL Make sure GlassFish is running OK | |
reboot -- you are done! | |
To start, stop, restart GlassFish simply run these commands: | |
sudo /etc/init.d/glassfish start | |
sudo /etc/init.d/glassfish stop | |
sudo /etc/init.d/glassfish restart | |
#!/bin/sh | |
# | |
# glassfish init script for Linux | |
# Simplest possible case -- no password file, one default domain | |
# it would be simple to add such options | |
GLASSFISH_HOME=${GLASSFISH_HOME:-"/opt/glassfishv3/glassfish"} | |
case "$1" in | |
start) | |
$GLASSFISH_HOME/bin/asadmin start-domain >/dev/null | |
;; | |
stop) | |
$GLASSFISH_HOME/bin/asadmin stop-domain >/dev/null | |
;; | |
restart) | |
$GLASSFISH_HOME/bin/asadmin restart-domain >/dev/null | |
;; | |
\*) | |
echo "usage: $0 (start|stop|restart|help)" | |
esac | |
/* | |
If all goes well you can set the init script up for automatic startup and shutdown: | |
sudo update-rc.d glassfish defaults 90 10 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi all of you how are I am Java Programmer in Ethiopia. sorry based on language problem go to my challenge, there is some problem happen in Auto-start in GlassFish server in Ubuntu Server 19.10 and most of the time Glassfish web app launch and after shutdown the computer also need re-launch to work how to solve this problem in glassfish server