Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Starting and Stopping Mule ESB

For the Impatient

Run Mule on Unix


              
           
1
$MULE_HOME/bin/mule start|stop

Run Mule on Windows


              
           
1
$MULE_HOME\bin\mule.bat start|stop

Mule uses the http://wrapper.tanukisoftware.org/[Java Service Wrapper] to control the Java Virtual Machine (JVM) from your native OS. The wrapper provides many options and features, including the ability to run Mule as a Unix daemon or install/remove Mule as a Windows Service. The wrapper can handle system signals and start parameters, and overall provides much better interaction between the JVM and the underlying OS.

For more information about the Java Service Wrapper, consult the http://wrapper.tanukisoftware.com/doc/english/introduction.html[online documentation].

Startup and Shutdown Script

The wrapper is called by a script in $MULE_HOME/bin.

Unix: $MULE_HOME/bin/mule

Windows: $MULE_HOME\bin\mule.bat

The table below lists all the parameters that the script accepts.

Parameter Description

start

Starts the Mule ESB server in the terminal background.

stop

Stops the Mule ESB server.

restart

Restarts the Mule ESB server.

status

Displays the status of the Mule ESB server (running or not running) and the process PID if running.

dump

(Unix only.) Dumps the Mule wrapper’s core to $MULE_HOME/log/mule_ee.log.

console

Start Mule ESB in the terminal foreground (console mode). Same as running mule with no parameters.

install

(Windows only.) Install Mule as a Windows service.

remove

(Windows only.) Remove Mule from your Windows services.

Starting and Stopping Mule Via the Command Line

Starting In the Background

  1. Use the cd command to navigate to the $MULE_HOME/bin directory.

  2. Run the startup script according to the options below.

    • Unix: ./mule start

    • Windows: mule.bat start

Alternatively, instead of using the cd command, type the full path of the script, for example /opt/mule/mule-ee-3.4.1/bin/mule start.

To stop Mule, run the script with the stop parameter.

Starting In the Foreground

  1. Use the cd command to navigate to the $MULE_HOME/bin directory.

  2. Run the startup script according to the options below.

    • Unix: ./mule

    • Windows: mule

Alternatively, instead of using the cd command, type the full path of the script, for example /opt/mule/mule-ee-3.4.1/bin/mule.

When running in foreground mode, the startup script displays information on the terminal’s standard output. You will not be able to issue further commands on the terminal as long as Mule is running.

To stop Mule, press CTRL-C in the terminal in which the script is running.

Passing Arguments to Mule At Startup

Configuration Files

By default, the Java Service Wrapper loads configuration options from the file mule-config.xml. This file is empty by default; it’s included in the $MULE_HOME/apps/default directory.

The -config parameter allows you to pass configuration files as arguments to the startup script.


          
       
1
./mule start -config <file1>[,<file2>,<file3>...]

To specify more than one configuration file, include the files in a comma-separated list.

Passing Parameters to the JVM via the Startup Command

Include your parameters as script parameters (if running in background, after the start parameter), as shown below. Separate parameters with a space if there is more than one.


          
       
1
./mule start -M-Dmule.mmc.bind.port=7783-7883

Passing Parameters to the JVM via the Wrapper Config File

Include your parameters in the configuration file $MULE_HOME/conf/wrapper.conf. The distribution includes this file with comments (see fragment below). You can edit this file or add to it as needed.  For more information about the  wrapper.conf file, consult the Java Service Wrapper  online documentation for the file.


          
       
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
# Name of the service
wrapper.ntservice.name=%MULE_APP%
 
# Display name of the service
wrapper.ntservice.displayname=%MULE_APP_LONG%
 
# Description of the service
wrapper.ntservice.description=%MULE_APP_LONG%
 
# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
 
# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
 
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
 
# Do not edit lines below!
wrapper.license.type=DEV
wrapper.license.id=201010160006
wrapper.license.licensee=mulesoft.com
wrapper.license.dev_application=Mule ESB Enterprise Edition
wrapper.license.features=64bit
...

Running Mule As a Unix Daemon

To run Mule as a Unix daemon, you need to write a simple wrapper script for the Mule startup script. Place your wrapper script in your system’s appropriate directory (such as /etc/init.d) and use your system’s init script architecture tools to ensure that your wrapper script is invoked in the runlevels you wish.

Your wrapper script needs to set the required environment for Mule; a sample script is provided below below.


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
 
# Set JDK related environment
JAVA_HOME=<path to JDK>
PATH=$PATH:$JAVA_HOME/bin
 
# Set Mule related environment
MULE_HOME=<path to Mule>
MULE_LIB=<path to application specific libraries>
PATH=$PATH:$MULE_HOME/bin
 
# Export environment variables
export JAVA_HOME MULE_HOME MULE_LIB PATH
 
# Invoke Mule
$MULE_HOME/bin/mule $1 -config <path to mule-conf.xml>

On some systems, you can set up startup scripts for use with the service utility (System V). Consult your operating system’s documentation for details.

Running Mule As a Windows Service

To install Mule as a Windows service, go to the $MULE_HOME/bin/ directory, then issue the following commands:


         
      
1
mule install

To remove Mule from your Windows services, go to the $MULE_HOME/bin/ directory, then run:


         
      
1
mule remove

Once Mule is installed as a service, you can control it with the following command:


         
      
1
mule start|restart|stop
  
To start Mule with additional configuration, issue:

         
      
1
mule start -config <your-config-file.xml>
  
Once Mule is installed as a service, you can also use the Windows `net` utility to start or stop it:

         
      
1
net start|stop mule

Common Parameters

The table below lists some parameters common to Mule, which are not documented in the wrapper.conf configuration file.

Parameter Description

-M-Dmule.agent.enabled

( Boolean ) Start Mule ESB with or without the Management Console agent, which is enabled by default.

-M-Dmule.mmc.bind.port

Specify a port or port range for the Mule ESB agent listener that the Management Console binds to. To specify a port range, use <port>-<port>, for example 3000-3010.

The $MULE_HOME/conf/wrapper.conf configuration file includes many more parameters, some of which are by default commented out, but documented in the comments. 

See Also