scale-catalog/jails/unifi/includes/rc/unifi_poller
Matt Coleman 66e997069a
Add Unifi Controller with integrated Unifi-Poller (#75)
* Add Unifi Controller with integrated Unifi-Poller
Install & Update uses 'latest' release. Persistent data using influxdb.

Unifi Poller now optional

* fix global dataset refs

* move unifi_poller bootscript into rc folder

* Apply suggestions from code review

* Update jails/unifi/includes/rc/mongod

Forgot to add one suggestion from review.

* Added shellcheck ignores for all RC scripts

Shellcheck doesn't play nice with RC scripts, those advices are often either wrong, or very hard (not worth it) to change enough to get it to pass and work.

* Last rc ignores for shellcheck

* Update jails/unifi/install.sh

* Shellcheck to shellcheck

Making shellcheck lowercase for parsing

Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
2020-04-29 18:40:14 +02:00

37 lines
1.0 KiB
Bash

#!/bin/sh
# shellcheck disable=SC1091,SC2034,SC2223,SC2154,SC1090,SC2046
#
# FreeBSD rc.d startup script for unifi-poller.
#
# PROVIDE: unifi-poller
# REQUIRE: networking syslog
# KEYWORD:
. /etc/rc.subr
name="unifi_poller"
real_name="unifi-poller"
rcvar="unifi_poller_enable"
unifi_poller_command="/usr/local/bin/${real_name}"
unifi_poller_user="nobody"
unifi_poller_config="/config/up.conf"
pidfile="/var/run/${real_name}/pid"
# This runs `daemon` as the `unifi_poller_user` user.
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -t ${real_name} -T ${real_name} -l daemon ${unifi_poller_command} -c ${unifi_poller_config}"
load_rc_config ${name}
: ${unifi_poller_enable:=no}
# Make a place for the pid file.
mkdir -p $(dirname ${pidfile})
chown -R $unifi_poller_user $(dirname ${pidfile})
# Suck in optional exported override variables.
# ie. add something like the following to this file: export UP_POLLER_DEBUG=true
[ -f "/usr/local/etc/defaults/${real_name}" ] && . "/usr/local/etc/defaults/${real_name}"
# Go!
run_rc_command "$1"