aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/unifi5/files
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2016-06-03 14:06:06 +0000
committerMark Felder <feld@FreeBSD.org>2016-06-03 14:06:06 +0000
commitb81adb943e62589ed925e5c734c10de1a7271ecc (patch)
treea07a13156e83005db79fd4363a99533df1d56d7d /net-mgmt/unifi5/files
parent01411752af7f56348255041e755d482bf1429b93 (diff)
downloadports-b81adb943e62589ed925e5c734c10de1a7271ecc.tar.gz
ports-b81adb943e62589ed925e5c734c10de1a7271ecc.zip
The UniFi Controller allows you to manage Wireless, Routing & Switching,
VoIP and Video of Ubiquiti Networks. WWW: http://wiki.ubnt.com/UniFi_FAQ
Notes
Notes: svn path=/head/; revision=416315
Diffstat (limited to 'net-mgmt/unifi5/files')
-rw-r--r--net-mgmt/unifi5/files/unifi.in75
1 files changed, 75 insertions, 0 deletions
diff --git a/net-mgmt/unifi5/files/unifi.in b/net-mgmt/unifi5/files/unifi.in
new file mode 100644
index 000000000000..8a479cf1f68c
--- /dev/null
+++ b/net-mgmt/unifi5/files/unifi.in
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# Created by: Mark Felder <feld@FreeBSD.org>
+# $FreeBSD$
+#
+
+# PROVIDE: unifi
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Add the following line to /etc/rc.conf to enable `unifi':
+#
+# unifi_enable="YES"
+
+. /etc/rc.subr
+name=unifi
+
+rcvar=unifi_enable
+load_rc_config ${name}
+
+: ${unifi_enable:=NO}
+: ${unifi_user:=%%USERS%%}
+: ${unifi_group:=%%GROUPS%%}
+: ${unifi_chdir=%%JAVASHAREDIR%%/unifi}
+: ${unifi_javaflags:="-Djava.awt.headless=true -Xmx1024M"}
+
+command_interpreter=.
+command="%%PREFIX%%/bin/java"
+command_args="${unifi_javaflags} -jar lib/ace.jar"
+start_cmd=start_cmd
+start_precmd=start_precmd
+stop_cmd=stop_cmd
+status_cmd=status_cmd
+pidfile="/var/run/${name}.pid"
+
+procname=$(JAVAVM_DRYRUN=yes ${command} | fgrep JAVAVM_COMMAND)
+
+start_precmd()
+{
+ if [ ! -e /var/run/unifi ] ; then
+ install -d -o %%USERS%% -g %%GROUPS%% /var/run/unifi;
+ fi
+}
+
+start_cmd()
+{
+ check_startmsgs && echo "Starting ${name}."
+ cd ${unifi_chdir}
+ daemon -u %%USERS%% -f -p ${pidfile} ${command} ${command_args} start
+}
+
+stop_cmd()
+{
+ check_startmsgs && echo "Stopping ${name}."
+ rc_pid=$(check_pidfile $pidfile $procname)
+ cd ${unifi_chdir}
+ ${command} ${command_args} stop
+ wait_for_pids $rc_pid
+}
+
+status_cmd()
+{
+ if [ -e ${pidfile} ] && $(pgrep -F ${pidfile} > /dev/null) ; then
+ mypid=$(cat ${pidfile})
+ fi
+
+ if [ ! ${mypid} = '' ]; then
+ echo "${name} is running with PID ${mypid}.";
+ else
+ echo "${name} not running?";
+ fi
+}
+
+run_rc_command "$1"