|
From: <php...@li...> - 2009-09-13 22:20:11
|
There is one in the CVS attic.
However, Tomcat or JEE servers are easier to handle, please use them as the
Java back end, if you can. -- these don't have obscure options like SERVLET
or SERVLET_LOCAL either. :)
Regards,
Jost Boekemeier
On Sep 14, 2009 12:13 AM, <php...@li...>
wrote:
Here is a little init script I wrote that I use to start/stop a php-
java-bridge standalone instance on my machine.
It took quite a bit of messing around to get all the various pieces
working and robust (ie logging startup failure output to the log file;
properly detecting the PID of java, etc).
I am not 100% confident that the line that launches the bridge is
perfect; so use your own knowledge to correct it. I am talking to Jost
in another thread about it at this time.
JAVA=/path/to/java
JAVA_BRIDGE_PATH=/path/to/JavaBridge.jar
CONTAINER_DIR=/path/to/my/project
#!/bin/zsh
PIDFILE=$CONTAINER_DIR/runtime/jvm.pid
start() {
echo "Starting JVM: "
LOGFILE=$CONTAINER_DIR/log/jvm.log
$JAVA -server -Xmx1200m -Dphp.java.bridge.default_log_level=5 -
jar $JAVA_BRIDGE_PATH SERVLET:9676 2>$LOGFILE 1>$LOGFILE &
echo $! > $PIDFILE
echo "waiting 5s for JVM to finish starting up..."
sleep 5
PID=`cat $PIDFILE`
ps -p $PID > /dev/null
if [ $? = 0 ]; then
echo "Java Bridge VM started in background, detached from
shell. PID=$PID"
exit 0
else
echo "Java Bridge VM failed to start."
exit 1
fi
}
stop() {
pid=`cat $PIDFILE`
echo "Stopping JVM (alleged pid $pid}): "
ps -p `cat $PIDFILE` | grep java
if [ $? = 0 ]; then
kill `cat $PIDFILE`
rm -f $PIDFILE
exit 0
else
echo "PID is not a jvm. Aborting stop."
exit 1
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo $"Usage: runbridge.sh {start|stop}"
exit 1
esac
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|