karaf-service scripts tries to create "data" directory in wrong location 
-------------------------------------------------------------------------

                 Key: KARAF-270
                 URL: https://issues.apache.org/jira/browse/KARAF-270
             Project: Karaf
          Issue Type: Bug
    Affects Versions: 2.1.0
         Environment: Unix
            Reporter: Joe Luo


To start FUSE ESB as a service, we need to install wrapper feature first:
{code}
$features:install wrapper
$wrapper:install
{code}
karaf-service and karaf-wrapper will be generated in "\bin" directory. Then we 
need to link karaf-service to /etc/init.d/. When we start the service through 
either "service karaf-service start" or "/etc/init.d/karaf-sevice start" 
command, the karaf-service scripts tries to create "data" directory in wrong 
location:
{code}
start() {
    echo "Starting $APP_LONG_NAME..."
    getpid
    if [ "X$pid" = "X" ]
    then
        if [ ! -d ../../data ]; then
            mkdir ../../data
        fi
        if [ ! -d ../../data/log ]; then
            mkdir ../../data/log
        fi
        COMMAND_LINE="$CMDNICE $WRAPPER_CMD $WRAPPER_CONF 
wrapper.syslog.ident=$APP_NAME wrapper.pid
file=$PIDFILE wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
        exec $COMMAND_LINE
    else
        echo "$APP_LONG_NAME is already running."
        exit 1
    fi
}
{code}
Basically, it tries to create "data" directory two levels up from 
"<apache-servicemix-4.2.0-fuse-01-00 install dir>/bin" directory.

If we install FUSE ESB into /opt directory, say we have directory structure 
like:
/opt/apache-servicemix-4.2.0-fuse-01-00
"/opt" is owned by root user. So the karaf-scripts tries to create "data" 
directory directly under "/opt" which is outside of 
"/opt/apache-servicemix-4.2.0-fuse-01-00". It will be fine if the service is 
started by root user. However, it will fail with below error if the service is 
started by any other users:
{quote}
    Starting karaf...
    mkdir: cannot create directory `../../data': Permission denied
    mkdir: cannot create directory `../../data/log': No such file or directory
{quote}
To fix this problem, we need to change "../../data" from generated 
karaf-service scripts to "../data"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to