-$JAVA_HOME/bin/java $@ \
- -Djava.io.tmpdir=${basedir}/work/tmp \
- -Dosgi.install.area=${basedir} \
- -Dosgi.configuration.area=${basedir}/configuration \
- -Dosgi.frameworkClassPath=${FWCLASSPATH} \
- -Dosgi.framework=file:${basedir}/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar \
- -classpath ${CLASSPATH} \
- org.eclipse.equinox.launcher.Main \
- -console \
- -consoleLog
+cd $basedir
+
+if [ "${stopdaemon}" -eq 1 ]; then
+ if [ -e "${pidfile}" ]; then
+ daemonpid=`cat "${pidfile}"`
+ kill "${daemonpid}"
+ rm -f "${pidfile}"
+ echo "Controller with PID: ${daemonpid} -- Stopped!"
+ exit 0
+ else
+ echo "Doesn't seem any Controller daemon is currently running"
+ exit -1
+ fi
+fi
+
+if [ "${statusdaemon}" -eq 1 ]; then
+ if [ -e "${pidfile}" ]; then
+ daemonpid=`cat "${pidfile}"`
+ ps -p ${daemonpid} > /dev/null
+ daemonexists=$?
+ if [ "${daemonexists}" -eq 0 ]; then
+ echo "Controller with PID: ${daemonpid} -- Running!"
+ exit 0
+ else
+ echo "Controller with PID: ${daemonpid} -- Doesn't seem to exist"
+ rm -f "${pidfile}"
+ exit 1
+ fi
+ else
+ echo "Doesn't seem any Controller daemon is currently running, at least no PID file has been found"
+ exit -1
+ fi
+fi
+
+iotmpdir=`echo "${datadir}" | sed 's/ /\\ /g'`
+bdir=`echo "${basedir}" | sed 's/ /\\ /g'`
+confarea=`echo "${datadir}" | sed 's/ /\\ /g'`
+fwclasspath=`echo "${FWCLASSPATH}" | sed 's/ /\\ /g'`
+
+if [ "${startdaemon}" -eq 1 ]; then
+ if [ -e "${pidfile}" ]; then
+ echo "Another instance of controller running, check with $0 -status"
+ exit -1
+ fi
+ $JAVA_HOME/bin/java ${extraJVMOpts} \
+ ${agentPath} \
+ -Djava.io.tmpdir="${iotmpdir}/work/tmp" \
+ -Dosgi.install.area="${bdir}" \
+ -Dosgi.configuration.area="${confarea}/configuration" \
+ -Dosgi.frameworkClassPath="${fwclasspath}" \
+ -Dosgi.framework=file:"${bdir}/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar" \
+ -Djava.awt.headless=true \
+ -classpath "${CLASSPATH}" \
+ org.eclipse.equinox.launcher.Main \
+ -console ${daemonport} \
+ -consoleLog &
+ daemonpid=$!
+ echo ${daemonpid} > ${pidfile}
+elif [ "${consolestart}" -eq 1 ]; then
+ if [ -e "${pidfile}" ]; then
+ echo "Another instance of controller running, check with $0 -status"
+ exit -1
+ fi
+ $JAVA_HOME/bin/java ${extraJVMOpts} \
+ ${agentPath} \
+ -Djava.io.tmpdir="${iotmpdir}/work/tmp" \
+ -Dosgi.install.area="${bdir}" \
+ -Dosgi.configuration.area="${confarea}/configuration" \
+ -Dosgi.frameworkClassPath="${fwclasspath}" \
+ -Dosgi.framework=file:"${bdir}/lib/org.eclipse.osgi-3.8.1.v20120830-144521.jar" \
+ -Djava.awt.headless=true \
+ -classpath "${CLASSPATH}" \
+ org.eclipse.equinox.launcher.Main \
+ -console \
+ -consoleLog
+fi