#!/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. # . %%RC_SUBR%% name="eXist" rcvar=`set_rcvar` # 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"