I'm trying to run Mule on Ubuntu 14.04 as a service. I created the following init script (/etc/init.d/mule)



# Set Mule related environment

# Export environment variables

# Invoke Mule
$MULE_HOME/bin/mule $1

Here I define some environment variables, most notably RUN_AS_USER since I want Mule to run as user mule.

When I call sudo service mule start I see nothing happening but when calling sudo /etc/init.d/mule start, Mule starts running fine.

Looking at the startup script for Mule, on line 419 the script is relaunched if it needs to be run as another user.


Why is it that when calling the init script directly, Mule starts running fine but when using the service utility, nothing happens? The man page for service says that it removes most environment variables. So I'm guessing that calling su depends on the environment somehow.


The problem was that the user mule didn't have a shell. It was set to /bin/false.

The -m flag for su preserves the environment, so when I called sudo /etc/init.d/mule start the SHELL environment variable was set and passed down to su.

But when calling sudo service mule start the environment is cleaned. From service man page:

service runs a System V init script or upstart job in as predictable an environment as possible, removing most environment variables and with the current working directory set to /.

Therefore the environment does not contain a SHELL variable and the user mule does not have a shell as well. So no command is executed it seems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.