literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
70 lines
1.6 KiB
Bash
70 lines
1.6 KiB
Bash
#!/bin/sh
|
|
#
|
|
# eXist startup script.
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: eXist
|
|
# REQUIRE: NETWORKING SERVERS
|
|
|
|
# Add the following lines to /etc/rc.conf to enable eXist:
|
|
# eXist_enable (bool): Set to "NO" by default.
|
|
# Set it to "YES" to enable eXist
|
|
# eXist_flags (str): Set to "-server" by default.
|
|
# Extra JVM flags.
|
|
#
|
|
. /etc/rc.subr
|
|
|
|
name="eXist"
|
|
rcvar=eXist_enable
|
|
|
|
# Read settings and set default values.
|
|
load_rc_config "$name"
|
|
: ${eXist_enable="NO"}
|
|
: ${eXist_flags="-server -Djetty.port=8081"}
|
|
|
|
# Variables.
|
|
eXist_user="%%EXIST_USER%%"
|
|
eXist_group="%%EXIST_GROUP%%"
|
|
eXist_home="%%DATADIR%%"
|
|
java_flags="-Xms16000k -Xmx128000k -Dfile.encoding=UTF-8 -Dexist.home=${eXist_home} -Djetty.home=${eXist_home}/tools/jetty -Djava.endorsed.dirs=${eXist_home}/lib/endorsed -jar ${eXist_home}/start.jar"
|
|
java_command="%%JAVA%% ${java_flags}"
|
|
|
|
# Commands.
|
|
pidfile="/var/run/${name}.pid"
|
|
command="/usr/sbin/daemon"
|
|
flags="-f -p ${pidfile} ${java_command} jetty ${eXist_flags} >${eXist_home}/startup.log 2>&1"
|
|
stop_cmd="eXist_stop"
|
|
|
|
# Subvert the check_pidfile procname check.
|
|
if [ -f $pidfile ]; then
|
|
read rc_pid junk < $pidfile
|
|
if [ ! -z "$rc_pid" ]; then
|
|
procname=`ps -o ucomm= $rc_pid`
|
|
fi
|
|
fi
|
|
if [ -z "$procname" ]; then
|
|
procname=nonexistent
|
|
fi
|
|
|
|
eXist_stop()
|
|
{
|
|
rc_pid=$(check_pidfile $pidfile $procname)
|
|
|
|
if [ -z "$rc_pid" ]; then
|
|
[ -n "$rc_fast" ] && return 0
|
|
if [ -n "$pidfile" ]; then
|
|
echo "${name} not running? (check $pidfile)."
|
|
else
|
|
echo "${name} not running?"
|
|
fi
|
|
return 1
|
|
fi
|
|
|
|
echo "Stopping ${name}."
|
|
${java_command} shutdown >${eXist_home}/shutdown.log 2>&1
|
|
wait_for_pids $rc_pid
|
|
}
|
|
|
|
run_rc_command "$1"
|