Azedi Technology

- apache (1)
- cfengine (2)
- development (1)
- dns (1)
- fault tolerance (1)
- hosting (3)
- industry (2)
- infrastructure (11)
- jvm tuning (1)
- ldap (1)
- monitoring (1)
- puppet (1)
- redhat (1)
- syzygy (1)
- todo (5)
- tomcat (10)


Tomcat Startup Scripts - Introduction

kief  2006-05-01 21:15       

Making all this work needs control scripts to start and stop your server. The scripts that come with Tomcat are fine at a rough level. You set up a couple of environment variables and away you go. But they have some drawbacks.

The benefits of having your own scripts that call the catalina scripts are:

  • Make sure the server runs as the appropriate user
  • Easily have multiple different configurations, with different CATALINA_BASE directories, with different applications and/or configurations. You can also have different versions of the JVM and Tomcat with the flip of a switch. Useful for servers with multiple applications, and also for development setups where you need to be able to switch the application quickly.
  • Avoid starting Tomcat when a previous instance is still running
  • Manage common tasks, such as rotating logs, and optionally cleaning out temp files and work directories (although be sure you know what you're doing in this case

What we'll do here is outline a decent script to do all of this. The basic version of the script will be intended for fairly straightforward setups, a single server instance, where you can change the options discussed by changing hard-coded variables in the script.

A more advanced version will cater for running multiple server instances on the same machine, with potentially different versions of Java and Tomcat. This will use configuration files to work out which options to use when running.

Ensuring the user

Here's a trick I use to ensure the server runs as the correct user. If the script is run as root, it simply uses the su command to re-run the script as the appropriate user. If it runs as a non-root user other than the intended one, it will try calling sudo command to re-run the script as root. If the user who runs the script has appropriate sudo permissions the script will be run as root, and then again as the appropriate user.

Insert code example here


order viagra cialis

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
More information about formatting options
Captcha Image: you will need to recognize the text in it.
Please type in the letters/numbers that are shown in the image above.

Recommended Services

Control Your Domain (white background)


Syndicate content