summaryrefslogtreecommitdiff
path: root/devel/p5-Java/files/javaserver.in
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2012-08-05 23:19:36 +0000
committerDoug Barton <dougb@FreeBSD.org>2012-08-05 23:19:36 +0000
commit9aac569eaa031e27191a3f4165b389a17f467ad2 (patch)
tree1ed78841e1757014ccc09581c61c3683992d3f77 /devel/p5-Java/files/javaserver.in
parentWhen installing in the base, USE_RCORDER does the right thing without (diff)
Move the rc.d scripts of the form *.sh.in to *.in
Where necessary add $FreeBSD$ to the file No PORTREVISION bump necessary because this is a no-op
Diffstat (limited to 'devel/p5-Java/files/javaserver.in')
-rw-r--r--devel/p5-Java/files/javaserver.in51
1 files changed, 51 insertions, 0 deletions
diff --git a/devel/p5-Java/files/javaserver.in b/devel/p5-Java/files/javaserver.in
new file mode 100644
index 000000000000..db4069de4e91
--- /dev/null
+++ b/devel/p5-Java/files/javaserver.in
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: javaserver
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable javaserver:
+# javaserver_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable apache22
+# javaserver_classpath (str): Set to "" by default.
+# Define your classpath here.
+# javaserver_user (str): Set to "nobody" by default.
+# Define owner of the javaserver process.
+
+. /etc/rc.subr
+
+name="javaserver"
+rcvar=javaserver_enable
+
+load_rc_config $name
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+pidfile="/var/run/${name}.pid"
+classpath="%%PREFIX%%"/share/p5-Java/JavaServer.jar
+
+[ -z "$javaserver_classpath" ] || classpath="${javaserver_classpath}":$classpath
+[ -z "$javaserver_enable" ] && javaserver_enable="NO"
+[ -z "$javaserver_user" ] && javaserver_user="nobody"
+
+javaserver_start()
+{
+ su -m ${javaserver_user} -c "nohup %%PREFIX%%/bin/java -cp ${classpath} com.zzo.javaserver.JavaServer >/dev/null & ; echo \$! " | tail -1 > ${pidfile}
+}
+
+javaserver_stop()
+{
+ if [ -f ${pidfile} ]; then
+ rc_pid=`cat ${pidfile}`
+ kill -TERM $rc_pid
+ wait_for_pids $rc_pid
+ rm ${pidfile}
+ fi
+}
+
+run_rc_command "$1"