From e22b44b5ecafb7a0cbe1757831713d5e5724d306 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 08:31:12 +0000 Subject: [PATCH 2/4] Fix cron jobs not running in Firefly III Data Importer addon - Change cronupdate shebang from bashio to /bin/bash (cron PATH lacks bashio) - Remove bashio API calls from cron script (no Supervisor access in cron) - Source /.env in cron script to load all env_vars from 00-global_var.sh - Persist SILENT_MODE to /etc/environment for cron access - Remove destructive `sed 's|root|www-data|g'` on /etc/crontab - Fix /etc/environment permissions from 600 to 644 for cron readability --- .../rootfs/etc/cont-init.d/99-run.sh | 10 ++++++---- fireflyiii_data_importer/rootfs/templates/cronupdate | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh b/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh index af03bdea6f..1cfc4a416a 100755 --- a/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh +++ b/fireflyiii_data_importer/rootfs/etc/cont-init.d/99-run.sh @@ -27,6 +27,10 @@ export CAN_POST_FILES="$(bashio::config "CAN_POST_FILES")" export CAN_POST_AUTOIMPORT="$(bashio::config "CAN_POST_AUTOIMPORT")" # Persist variables to /etc/environment for cron jobs +SILENT_MODE="false" +if bashio::config.true 'silent'; then + SILENT_MODE="true" +fi { [ -n "$JSON_CONFIGURATION_DIR" ] && echo "JSON_CONFIGURATION_DIR=\"$JSON_CONFIGURATION_DIR\"" echo "CONFIG_LOCATION=\"$CONFIGSOURCE\"" @@ -35,8 +39,9 @@ export CAN_POST_AUTOIMPORT="$(bashio::config "CAN_POST_AUTOIMPORT")" echo "AUTO_IMPORT_SECRET=\"$AUTO_IMPORT_SECRET\"" echo "CAN_POST_FILES=\"$CAN_POST_FILES\"" echo "CAN_POST_AUTOIMPORT=\"$CAN_POST_AUTOIMPORT\"" + echo "SILENT_MODE=\"$SILENT_MODE\"" } >> /etc/environment -chmod 600 /etc/environment +chmod 644 /etc/environment ################ # CRON OPTIONS # @@ -54,9 +59,6 @@ if bashio::config.has_value 'Updates'; then cp /templates/cronupdate /etc/cron."${FREQUENCY}"/ chmod 755 /etc/cron."${FREQUENCY}"/cronupdate - # Sets cron to run with www-data user - sed -i 's|root|www-data|g' /etc/crontab - # Starts cron service cron start diff --git a/fireflyiii_data_importer/rootfs/templates/cronupdate b/fireflyiii_data_importer/rootfs/templates/cronupdate index b4769c1cb4..494d55a945 100644 --- a/fireflyiii_data_importer/rootfs/templates/cronupdate +++ b/fireflyiii_data_importer/rootfs/templates/cronupdate @@ -1,18 +1,20 @@ -#!/usr/bin/env bashio +#!/bin/bash # shellcheck shell=bash set -e # Source environment variables for cron context # shellcheck disable=SC1091 if [ -f /etc/environment ]; then set -a; . /etc/environment; set +a; fi +# shellcheck disable=SC1091 +if [ -f /.env ]; then set -a; . /.env; set +a; fi # Use persisted value instead of calling bashio::config (www-data may lack API access) CONFIGSOURCE="${CONFIG_LOCATION}" ( -bashio::log.info "Running update according to defined schedule. Files located in $CONFIGSOURCE/import_files will be imported. If /config, it is accessible in the folder /addon_configs/xxx-firefly_data_importer when using the Filebrowser addon" -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" +echo "[INFO] Running update according to defined schedule. Files located in $CONFIGSOURCE/import_files will be imported." +if [ "${SILENT_MODE}" = "true" ]; then + echo "[WARNING] Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug" /usr/local/bin/php /var/www/html/artisan importer:auto-import "$CONFIGSOURCE/import_files" >/dev/null else /usr/local/bin/php /var/www/html/artisan importer:auto-import "$CONFIGSOURCE/import_files" From 92dbc304103e0f359a40d59cf06c4dee21df655c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 09:09:37 +0000 Subject: [PATCH 3/4] Bump fireflyiii_data_importer to 2.3.2-5 and update changelog --- fireflyiii_data_importer/CHANGELOG.md | 3 +++ fireflyiii_data_importer/config.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fireflyiii_data_importer/CHANGELOG.md b/fireflyiii_data_importer/CHANGELOG.md index 5f4149e13e..f92fb42a01 100644 --- a/fireflyiii_data_importer/CHANGELOG.md +++ b/fireflyiii_data_importer/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.3.2-5 (28-05-2026) +- Fix cron jobs not running (wrong shebang, missing env vars, broken crontab) + ## 2.3.2-4 (18-05-2026) - Minor bugs fixed ## 2.3.2-3 (18-05-2026) diff --git a/fireflyiii_data_importer/config.yaml b/fireflyiii_data_importer/config.yaml index 95ffd1e280..b179f8f411 100644 --- a/fireflyiii_data_importer/config.yaml +++ b/fireflyiii_data_importer/config.yaml @@ -101,5 +101,5 @@ schema: slug: fireflyiii_data_importer udev: true url: https://github.com/alexbelgium/hassio-addons -version: "2.3.2-4" +version: "2.3.2-5" webui: "[PROTO:ssl]://[HOST]:[PORT:8080]" From 3ad1b40ecfb7d026578ee99ddcf42cf1334c022f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 09:19:15 +0000 Subject: [PATCH 4/4] Run cron artisan import as www-data to prevent permission conflicts --- fireflyiii_data_importer/rootfs/templates/cronupdate | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fireflyiii_data_importer/rootfs/templates/cronupdate b/fireflyiii_data_importer/rootfs/templates/cronupdate index 494d55a945..eff247b11b 100644 --- a/fireflyiii_data_importer/rootfs/templates/cronupdate +++ b/fireflyiii_data_importer/rootfs/templates/cronupdate @@ -15,8 +15,8 @@ CONFIGSOURCE="${CONFIG_LOCATION}" echo "[INFO] Running update according to defined schedule. Files located in $CONFIGSOURCE/import_files will be imported." if [ "${SILENT_MODE}" = "true" ]; then echo "[WARNING] Silent mode activated. Only errors will be shown. Please disable in addon options if you need to debug" - /usr/local/bin/php /var/www/html/artisan importer:auto-import "$CONFIGSOURCE/import_files" >/dev/null + sudo -Eu www-data /usr/local/bin/php /var/www/html/artisan importer:auto-import "$CONFIGSOURCE/import_files" >/dev/null else - /usr/local/bin/php /var/www/html/artisan importer:auto-import "$CONFIGSOURCE/import_files" + sudo -Eu www-data /usr/local/bin/php /var/www/html/artisan importer:auto-import "$CONFIGSOURCE/import_files" fi ) &>/proc/1/fd/1