Ubuntu uses Upstart to handle starting, stopping and supervising of services. This page describes how to run Apache ServiceMix as a service on Ubuntu.
Configuring Upstart to run ServiceMix
For Upstart, every service is defined in its own file in /etc/event.d. To add ServiceMix, just create /etc/event.d/servicemix with the contents shown below:
In this example:
- ServiceMix automatically starts/stops with the system
- a time-out of 15 seconds was configured between sending TERM and KILL signals when stopping the service, to allow ServiceMix to shut down properly
- when ServiceMix dies unexpectedly, the service will automatically be restarted by Upstart
- the default ServiceMix distribution has been extracted to /opt/servicemix, no modifications are required to the standard script
Using Upstart to control ServiceMix
The example above will start/stop ServiceMix automatically with the system, but you can also control the service from a command line:
- sudo initctl start servicemix starts ServiceMix manually
- sudo initctl status servicemix will show you the current status of the service, as well as the PID when running
- sudo initctl stop servicemix stops ServiceMix manually