Hello everybody,
I have made my felix to execute in background, my daemon script is based on
linux initscripts and screen, being writed as follows:
#StartOf-osgid-------------------------------------------------------------------------------------
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
DAEMON=OSGi
OSGI_HOME="/opt/OSGi"
FELIX_HOME="${OSGI_HOME}/felix-framework-4.0.3"
OSGI_REPO="${OSGI_HOME}/bundleRepo"
java="/opt/java/bin/java"
screen="/usr/bin/screen"
session_name="$DAEMON"
ARGS=""
pidof(){
echo $($screen -ls | grep "${session_name}" | awk '{print$1}' | sed
's/\.'"${session_name}"'//')
}
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
PID=$(pidof)
start(){
stat_busy "Starting $DAEMON"
if [ -z "$PID" ]; then
cd "$FELIX_HOME"
${screen} -dmS "${session_name}" ${java} -jar bin/felix.jar
"${OSGI_REPO}"
$ARGS
if [ $? = 0 ]; then
add_daemon $DAEMON
stat_done
else
stat_fail
exit 1
fi
else
echo -e "Already started or busy\nPIDs ${PID}"
stat_fail
exit 1
fi
}
case "$1" in
start)
start
;;
stop)
stat_busy "Stopping $DAEMON"
[ -n "$PID" ] && kill $PID &>/dev/null
if [ $? = 0 ]; then
rm_daemon $DAEMON
stat_done
else
stat_fail
exit 1
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
#EndOf-osgid-------------------------------------------------------------------------------------
After installing this daemon, you would access felix CLI by the command
'screen -r OSGi' or if you have installed remote shell for felix, telnet
localhost 6666.
Best regards,
Marotta
--
View this message in context:
http://apache-felix.18485.n6.nabble.com/Felix-as-a-Daemon-tp4835859p5001073.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]