Tag Archives: startup

Autostart Glassfish on startup in Ubuntu

To make the Glassfish Server auto start with startup, we need to setting up an init script, which helps us to manage all Glassfish Server startup events easily. And also make Glassfish start up automatically whenever Ubuntu is rebooting.

This script file is glassfish to be created at /etc/init.d/. For managing all Glassfish Server startup events, it ships with the asadmin tool. Use this tool in the startup script as follows,

  1. Create or edit glassfish file
  2. Paste the following lines in the file

Now, glassfish startup script is created. We need to add this file in startup to make Glassfish Server autostart during Ubuntu startup. Follow these steps,

  1. Make the startup script file executable
  2. Add this file to Ubuntu startup boot

That’s it. Now, restart Ubuntu and check if it really autostart the Glassfish Server.

You can also manage Glassfish Server startup events as follows,

  • Start the server
  • Stop the server
  • Restart the server

     

Automatically start Tomcat on startup in Ubuntu

Apache Tomcat is not configured with autostart by default in Ubuntu. So, custom init script is required to configure Tomcat for autostart on startup.

Create the init script in /etc/init.d/tomcat8 with the contents as per below.

Init script contents:

Note: Please change {tomcat_root} with your Tomcat installation folder path.

Change its permissions and add the correct symlinks automatically:

And from now on it will be automatically started and shut down upon entering the appropriate run levels.

It could be also controlled with justservice tomcat8 <stop|start|restart> like Apache control commands.

Using above process any server script can be created and configured to start on startup.