On a production server, we need to configure Tomcat as the system service, that is, a program running at boot without any users' action. If you install Tomcat on Windows, the installer creates the service for you and sets it for an automatic startup.
Are you wondering how to do it on Linux? In this recipe, we are going to configure your Linux box for automatic start of services. We will create a script and learn how it works.
Open your preferred editor and enter the following lines. Be sure to launch the editor with
sudo
, as we are going to create a file in a system folder:#!/bin/sh ### BEGIN INIT INFO # Provides: tomcat # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat v7.0.42 ### END INIT INFO # # /etc/init.d/tomcat # export JAVA_HOME=/usr/lib/jvm/jre1.6.0_37 export...