{"id":50,"date":"2015-09-05T15:05:14","date_gmt":"2015-09-05T13:05:14","guid":{"rendered":"http:\/\/geekinto.com\/?p=50"},"modified":"2015-09-05T15:08:14","modified_gmt":"2015-09-05T13:08:14","slug":"how-to-run-glassfish-v4-1-as-a-service-on-linux-ubuntudebian","status":"publish","type":"post","link":"https:\/\/howoracleapex.com\/?p=50","title":{"rendered":"How to Run GlassFish V4.1 as a Service on Linux Ubuntu\/Debian"},"content":{"rendered":"<blockquote><p>source:<\/p><\/blockquote>\n<ul>\n<li><a href=\"https:\/\/blogs.oracle.com\/foo\/entry\/how_to_run_glassfish_v3\">https:\/\/blogs.oracle.com\/foo\/entry\/how_to_run_glassfish_v3<\/a><\/li>\n<li><a href=\"http:\/\/computingwithjasper.blogspot.com.eg\/2008\/01\/installing-glassfish-2-on-ubuntu-710.html\">http:\/\/computingwithjasper.blogspot.com.eg\/2008\/01\/installing-glassfish-2-on-ubuntu-710.html<\/a><\/li>\n<li><a href=\"https:\/\/gist.github.com\/AmrAbdeen\/642183789c0f0ba91613\">https:\/\/gist.github.com\/AmrAbdeen\/642183789c0f0ba91613<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>We already support running GlassFish V3 as a service on Solaris 10 and Windows platforms (see my <a title=\"services\" href=\"https:\/\/blogs.oracle.com\/foo\/entry\/platform_services_available_in_v3\">blog<\/a>).\u00a0 I have been investigating how to provide support for automatically starting GlassFish V3 as a service on Linux.\u00a0 Of course before I can hope to do that &#8212; I must be able to set it up manually.\u00a0 In this blog I will take you through the manual steps needed to run GlassFish V3 as a service on Linux.<\/p>\n<p>This procedure was worked out on my Linux system which happens to be Ubuntu.\u00a0 Other flavors of Linux may have slightly different procedures.<\/p>\n<p>One decision you need to make right up front is what Linux user should &#8220;own&#8221; GlassFish V3.\u00a0 Typically root is used as the owner.\u00a0 If you choose root as the user you get the advantage that you can use ports &lt; 1024 without complex configuration changes to the system.\u00a0 For this blog I used root.<\/p>\n<p>Here are the steps\u00a0 &#8212; the file named &#8220;glassfish&#8221; in step 4 is the simple init script which appears at the end of this blog.<\/p>\n<ol>\n<li>Install JDK 6 if needed<\/li>\n<li>Have root install GlassFish like so:\n<ol>\n<li>cd \/opt<\/li>\n<li>wget\u00a0 http:\/\/download.java.net\/glassfish\/v3\/release\/glassfish-v3.zip<\/li>\n<li>unzip glassfish-v3.zip<\/li>\n<li>rm glassfish-v3.zip<\/li>\n<\/ol>\n<\/li>\n<li>cd \/etc\/init.d<\/li>\n<li>cp glassfish .<\/li>\n<li>update-rc.d glassfish defaults<\/li>\n<li>OPTIONAL \/etc\/init.d\/glassfish start<\/li>\n<li>OPTIONAL Make sure GlassFish is running OK<\/li>\n<li>reboot &#8212; you are done!<\/li>\n<\/ol>\n<p>To start, stop, restart GlassFish simply run these commands:<\/p>\n<pre class=\"lang:sh decode:true \">sudo \/etc\/init.d\/glassfish start\r\nsudo \/etc\/init.d\/glassfish stop\r\nsudo \/etc\/init.d\/glassfish restart<\/pre>\n<p>&#8212;<\/p>\n<pre class=\"lang:sh decode:true \">#!\/bin\/sh\r\n#\r\n# glassfish init script for Linux \r\n# Simplest possible case -- no password file, one default domain\r\n# it would be simple to add such options\r\n\r\nGLASSFISH_HOME=${GLASSFISH_HOME:-\"\/opt\/glassfishv3\/glassfish\"}\r\n\r\ncase \"$1\" in\r\nstart)\r\n    $GLASSFISH_HOME\/bin\/asadmin start-domain &gt;\/dev\/null\r\n    ;;\r\nstop)\r\n    $GLASSFISH_HOME\/bin\/asadmin stop-domain &gt;\/dev\/null\r\n    ;;\r\nrestart)\r\n    $GLASSFISH_HOME\/bin\/asadmin restart-domain &gt;\/dev\/null\r\n    ;;\r\n\\*)\r\n    echo \"usage: $0 (start|stop|restart|help)\"\r\nesac<\/pre>\n<p>If all goes well you can set the init script up for automatic startup and shutdown:<\/p>\n<pre class=\"lang:sh decode:true \">sudo update-rc.d glassfish defaults 90 10<\/pre>\n<p>Have fun &#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 https:\/\/gist.github.com\/AmrAbdeen\/642183789c0f0ba91613 &nbsp; We already support running GlassFish V3 as a service on Solaris 10 and Windows platforms (see my blog).\u00a0 I have been investigating how to provide support for automatically starting&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,16,19],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-apex","category-glassfish","category-linux"],"_links":{"self":[{"href":"https:\/\/howoracleapex.com\/index.php?rest_route=\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howoracleapex.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howoracleapex.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howoracleapex.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/howoracleapex.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=50"}],"version-history":[{"count":3,"href":"https:\/\/howoracleapex.com\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/howoracleapex.com\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions\/53"}],"wp:attachment":[{"href":"https:\/\/howoracleapex.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howoracleapex.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howoracleapex.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}