aboutsummaryrefslogtreecommitdiff
path: root/databases/exist/files/eXist.in
blob: 0e9e0df92cb6dda3a019dd44db4746473497eed0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/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"