HowTo: How to run multiple Wrapper instances on UNIX |
||||||||||
The Wrapper has been designed to make it easy to run multiple instances on the same system without any special configuration. This relies on the individual applications being run each being in their own directory and/or having their own name. To avoid confusion, it best that they each have their own name even when running in different directories. A typical running application that has been integrated with the Wrapper will have the following directory structure:
In this example, the myapp.
When the script runs, any relative paths will be relative to the location of the shell script. (However, when the Wrapper itself is launched, it will set its working directory to that of the Wrapper binary.)
When the Wrapper is launched, it will write out a PID file named
"$PIDDIR/$APP_NAME. Depending on how the shell script is configured, the Wrapper may also make use of one or more of the following files, using the same naming pattern:
Some UNIX platforms also define a lock directory, "/var/lock/subsys". When that directory exists and is writable, the Wrapper will also write out a lock file: "/var/lock/subsys/$APP_NAME". Such platforms use this lock file to tell which services are currently running. As a rule, it is, thus, a good idea to make sure that you don't run more than one application with the same name, even if they are located in different directories. If you do, then the last one started will overwrite the lock file, and the first one to shut down will delete it. This will not affect the Wrapper's shell script, but could cause problems for other management software.
If you want to run two applications using the same physical Wrapper binary,
they will both be running in the same working directory. This means that
you will need to make sure that the two applications have different shell
scripts, with different application names ($APP_NAME), and also use
different wrapper. It is also possible to make use of the wrapper.working.dir property in each configuration file to control where each application runs. If you take this route, please be sure to fully read the property documentation to save yourself some time. |