summaryrefslogtreecommitdiff
path: root/www/resin3/files/resin3.in
blob: 2df6840722fdf21e37436b1e02fc930510a3d8bd (plain)
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
#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/www/resin3/files/resin3.in,v 1.2 2012-04-04 17:38:13 jgh Exp $
#

# PROVIDE: %%APP_NAME%%
# REQUIRE: LOGIN NETWORKING SERVERS
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable %%APP_NAME%%:
#
# %%APP_NAME%%_enable="YES"
#


%%APP_NAME%%_enable="${%%APP_NAME%%_enable:-"NO"}"
%%APP_NAME%%_user="${%%APP_NAME%%_user:-"www"}"
%%APP_NAME%%_group="${%%APP_NAME%%_group:-"www"}"

. /etc/rc.subr

name="%%APP_NAME%%"
rcvar="%%APP_NAME%%"_enable

load_rc_config ${name}

command="%%PREFIX%%/sbin/%%APP_NAME%%ctl"
command_args="start"
pidfile="%%PID_FILE%%"

if test -n "${%%APP_NAME%%_java_version}" ; then
    JAVA_HOME=$(JAVA_VERSION="${%%APP_NAME%%_java_version}" JAVAVM_DRYRUN=1 %%LOCALBASE%%/bin/java | grep JAVA_HOME | cut -d= -f2)
    procname=$(JAVA_VERSION="${%%APP_NAME%%_java_version}" JAVAVM_DRYRUN=1 %%LOCALBASE%%/bin/java | grep JAVAVM_PROG | cut -d= -f2)
else
    JAVA_HOME=$(JAVAVM_DRYRUN=1 %%LOCALBASE%%/bin/java | grep JAVA_HOME | cut -d= -f2)
    procname=$(JAVAVM_DRYRUN=1 %%LOCALBASE%%/bin/java | grep JAVAVM_PROG | cut -d= -f2)
fi

export JAVA_HOME

run_rc_command "$1"