This commit is contained in:
Alexandre
2023-11-21 09:53:56 +01:00
parent 2e6e4693a7
commit 8e035dde96
350 changed files with 1908 additions and 1328 deletions

View File

@@ -1,3 +1,7 @@
### 1.3.0 (05-11-2023)
- Adds working cron job
- Adds more daily update options differing in the hour of the day at which is updated
### 1.2-11 (23-09-2023)
- Minor bugs fixed
- Implemented healthcheck

View File

@@ -63,7 +63,7 @@ RUN chmod 777 "/ha_entrypoint.sh"
# Entrypoint modifications
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh"
RUN chmod 777 "/ha_entrypoint_modif.sh"
RUN /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh
RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh
ENTRYPOINT [ "/usr/bin/env" ]

View File

@@ -30,6 +30,10 @@ Read official documentation for information how to set : https://github.com/bnw/
Configurations can be added in the /config/addons_config/fireflyiii_fints_importer/ folder according to : https://github.com/bnw/firefly-iii-fints-importer#storing-configurations
### Cron job
A cron job running all configurations perdiodically can be activated by selecting a period. Please note the periods `daily2`, `daily4`, etc. run at 2am, 4am, etc., so you can select the hour when to update.
## Installation
The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.

View File

@@ -74,11 +74,12 @@
"8080/tcp": "web interface"
},
"schema": {
"Updates": "list(|hourly|daily2|daily4|daily6|daily8|daily10|daily12|weekly)?",
"silent": "bool?"
},
"slug": "fireflyiii_fints_importer",
"udev": true,
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.2-11",
"version": "1.3.0",
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]"
}

View File

@@ -28,15 +28,26 @@ if bashio::config.has_value 'Updates'; then
bashio::log.info "$FREQUENCY updates"
echo ""
for i in $(seq 4 2 12)
do
hour=" $i"
freqDir="/etc/periodic/daily$i"
echo "0 ${hour:(-4)} * * * run-parts \"$freqDir\"" >> /etc/crontabs/root
mkdir "$freqDir"
done
# Sets cron // do not delete this message
cp /templates/cronupdate /etc/cron."${FREQUENCY}"/
chmod 777 /etc/cron."${FREQUENCY}"/cronupdate
freqDir="/etc/periodic/${FREQUENCY}"
cp /templates/cronupdate "$freqDir/"
chmod 777 "$freqDir/cronupdate"
# Sets cron to run with www-data user
# sed -i 's|root|www-data|g' /etc/crontab
# Starts cron
service cron start
echo "Timezone $TZ"
export TZ
crond -l 2 -f > /dev/stdout 2> /dev/stderr &
# Export variables
IMPORT_DIR_WHITELIST="${CONFIGSOURCE}/import_files"

View File

@@ -2,15 +2,20 @@
# shellcheck shell=bash
set -e
PATHTOFILES="$(bashio::config "CONFIG_LOCATION")"
PATHTOFILES="$(dirname "${PATHTOFILES}")"
PATHTOFILES="/data/configurations"
(
bashio::log.info "Running update according to defined schedule. Files located in $PATHTOFILES will be imported"
if bashio::config.true 'silent'; then
bashio::log.warning "Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug"
su -l www-data -s /bin/bash -c "/usr/local/bin/php /var/www/html/artisan importer:auto-import >/dev/null"
for config in "$PATHTOFILES"/*.json
do
curl --get --data-urlencode "automate=true" --data-urlencode "config=$config" http://localhost:8080 2> /dev/null
done
else
su -l www-data -s /bin/bash -c "/usr/local/bin/php /var/www/html/artisan importer:auto-import $PATHTOFILES/import_files"
for config in "$PATHTOFILES"/*.json
do
curl -vvv --get --data-urlencode "automate=true" --data-urlencode "config=$config" http://localhost:8080
done
fi
) &>/proc/1/fd/1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB