On 9/9/10 8:54, Wunden Tobias wrote:
Hello everyone,

I recently tried to install and run Felix 3.0.2 on Gentoo Linux. For this 
purpose, I created a start script to start and stop Felix depending on the 
current runlevel (see below). Gentoo's start-stop-daemon usually is a great 
choice to achieve that goal, but in this case, I am running into the following 
issues:

When I start Felix using /etc/init.d/felix start, I can see the process as well as the shell's 
output in the logs. However, as soon as I log out, the felix process is killed immediately 
(despite the --background option to the start-stop-daemon). In addition, when I start typing 
in the shell that was used to start Felix, e. g. to do a "ps aux" to list the 
running processes", every second character hit is not echoed to the shell.

All this indicated a connection to the Felix shell (gogo), and the only way to solve 
the problem was by removing all gogo bundles from<felix_home>/bundle. After 
that, the start-stop-daemon behaved as intended and the login shell kept working as 
expected.

It seems like the Gogo interactive shell is causing you difficulties. When the Gogo shell starts up, it expects to either 1) start an interactive session or 2) execute a command. You can avoid (1) by doing (2) and telling it to not shutdown the framework, something like this:

    java -Dgosh.args='--noshutdown -c noop=true' -jar bin/felix.jar

Then if you also install the newly released Remote Shell bundle, you can telnet into the running framework. In fact, Gogo has a built-in telnet command, so I think you could just directly start it like this without the Remote Shell bundle:

    java -Dgosh.args='-sc telnetd -p1234 start' -jar bin/felix.jar

Either approach will start Gogo without an interactive session and the ability to telnet into it.

-> richard

Now I guess my question would be: did I miss anything, i. e. is there a way to 
start felix using java -jar<felix_home/felix.jar that starts felix in a daemon 
mode?

Thanks for any hint on this!
Tobias

/etc/conf.d/felix:
============

# felix filesystem layout

FELIX_HOME="/usr/share/felix"
FELIX_CONFDIR="/etc/felix"
FELIX_LOGDIR="/var/log/felix"
FELIX_TEMPDIR="/var/tmp/felix"

# felix configuration

FELIX_BUNDLECACHE="${FELIX_TEMPDIR}/felix-cache"
FELIX_FILEINSTALL_OPTS="-Dfelix.fileinstall.dir=${FELIX_HOME}/load"
PAX_CONFMAN_OPTS="-Dbundles.configuration.location=${FELIX_CONFDIR}"
PAX_LOGGING_OPTS="-Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN"

# Runtime environment setup

LOG_FILE="${FELIX_LOGDIR}/felix.out"
PID_FILE="/var/run/felix.pid"
FELIX_USER="felix"
FELIX_GROUP="felix"

# JVM configuration

JAVA_HOME="$(java-config --jre-home)"
JVM_MEMORY_OPTS="-Xmx1024m -Xms512m"
JVM_ENCODING_OPTS="-Dfile.encoding=utf-8"


# Java options and commandline

FELIX_OPTS="${FELIX_FILEINSTALL_OPTS} ${PAX_CONFMAN_OPTS} ${PAX_LOGGING_OPTS}"
JVM_OPTS="-server ${JVM_MEMORY_OPTS} ${JVM_ENCODING_OPTS}"

# Final command
RUN_CMD="${JAVA_HOME}/bin/java"
RUN_OPTS="${JVM_OPTS} ${FELIX_OPTS} -jar ${FELIX_HOME}/bin/felix.jar 
${FELIX_BUNDLECACHE}"

/etc/init.d/felix:
===========

#!/sbin/runscript
# Distributed under the terms of the GNU General Public License v2

depend() {
        use net
        after logger
}

start() {
        ebegin "Starting Felix"
        mkdir -p "${FELIX_LOGDIR}" "${FELIX_BUNDLECACHE}"
        chown -R ${FELIX_USER}:${FELIX_GROUP} "${FELIX_LOGDIR}" 
"${FELIX_BUNDLECACHE}"
        if [ ! -d "${FELIX_HOME}" ]; then
            eerror "Felix home directory ${FELIX_HOME} not found"
            return 1
        fi
        start-stop-daemon --start \
            --background \
            --user ${FELIX_USER} \
            --group ${FELIX_GROUP} \
            --chdir ${FELIX_HOME} \
            --make-pidfile \
            --pidfile "${PID_FILE}" \
            --stdout "${LOG_FILE}" \
            --stderr "${LOG_FILE}" \
            --exec "${RUN_CMD}" -- ${RUN_OPTS}
        eend $result
}

stop()  {
        ebegin "Stopping Felix"
        start-stop-daemon --stop \
            --pidfile "${PID_FILE}"
        if [ -e "${PID_FILE}" ]; then
          rm "${PID_FILE}"
        fi
        eend $?
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to