Merge pull request #180 from colemamd/unifidb-fix

Fix Unifi DB creation in InfluxDB
This commit is contained in:
Kjeld Schouten-Lebbing 2020-06-19 01:31:19 +02:00 committed by GitHub
commit 2cbeb33791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 24 deletions

View File

@ -63,10 +63,7 @@ iocage exec "${1}" sysrc unifi_enable=YES
iocage exec "${1}" service unifi start iocage exec "${1}" service unifi start
# shellcheck disable=SC2154 # shellcheck disable=SC2154
if [[ ! "${!POLLER}" ]]; then if [ "${!POLLER}" == true ]; then
echo "Installation complete!"
echo "Unifi Controller is accessible at https://${JAIL_IP}:8443."
else
# Check if influxdb container exists, create unifi database if it does, error if it is not. # Check if influxdb container exists, create unifi database if it does, error if it is not.
echo "Checking if the database jail and database exist..." echo "Checking if the database jail and database exist..."
if [[ -d /mnt/"${global_dataset_iocage}"/jails/"${!DB_JAIL}" ]]; then if [[ -d /mnt/"${global_dataset_iocage}"/jails/"${!DB_JAIL}" ]]; then
@ -116,4 +113,7 @@ else
echo "Unifi Controller is accessible at https://${JAIL_IP}:8443." echo "Unifi Controller is accessible at https://${JAIL_IP}:8443."
echo "Please login to the Unifi Controller and add ${UP_USER} as a read-only user." echo "Please login to the Unifi Controller and add ${UP_USER} as a read-only user."
echo "In Grafana, add Unifi-Poller as a data source." echo "In Grafana, add Unifi-Poller as a data source."
else
echo "Installation complete!"
echo "Unifi Controller is accessible at https://${JAIL_IP}:8443."
fi fi

View File

@ -2,10 +2,10 @@
# This file contains the update script for unifi # This file contains the update script for unifi
# Unifi Controller is updated through pkg, Unifi-Poller is not. This script updates Unifi-Poller # Unifi Controller is updated through pkg, Unifi-Poller is not. This script updates Unifi-Poller
if [[ ! "${!POLLER}" ]]; then POLLER="jail_${1}_unifi_poller"
echo "Skipping Unifi Poller for update, not installed"
else
# shellcheck disable=SC2154
if [ "${!POLLER}" == true ]; then
FILE_NAME=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .name") FILE_NAME=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .name")
DOWNLOAD=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .browser_download_url") DOWNLOAD=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .browser_download_url")
@ -21,6 +21,9 @@ else
iocage exec "${1}" service unifi_poller restart iocage exec "${1}" service unifi_poller restart
fi fi
else
echo "Skipping Unifi Poller for update, not installed"
fi fi
iocage exec "${1}" service unifi restart iocage exec "${1}" service unifi restart
echo "Update complete!" echo "Update complete!"

View File

@ -196,7 +196,7 @@ else
then then
echo "Updating $jail" echo "Updating $jail"
iocage update "${jail}" iocage update "${jail}"
iocage exec "${jail}" "pkg update && pkg upgrade -y" && "${SCRIPT_DIR}"/jails/"${!blueprint}"/update.sh iocage exec "${jail}" "pkg update && pkg upgrade -y" && "${SCRIPT_DIR}"/blueprints/"${!blueprint}"/update.sh "${jail}"
iocage restart "${jail}" iocage restart "${jail}"
iocage start "${jail}" iocage start "${jail}"
else else