changeset 401:d2796c709dcf

Make the list of existing trigger files available to conditions and actions
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 25 Feb 2023 15:17:38 +0100
parents 357887df56f5
children 1ccd7bf1ed06
files etc/periodic/daily/720.local-triggered-action
diffstat 1 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/etc/periodic/daily/720.local-triggered-action	Sat Feb 25 13:09:53 2023 +0100
+++ b/etc/periodic/daily/720.local-triggered-action	Sat Feb 25 15:17:38 2023 +0100
@@ -113,16 +113,12 @@
         echo "Testing for newly triggered action${profilestr}"
 
         _do_action=""
-        _remove_files=""
+        TRIGGER_FILES=""
 
         for _f in ${daily_local_triggered_action_files}; do
             if [ -r "${_f}" ]; then
                 _do_action="yes"
-                case "${daily_local_triggered_action_files_remove}" in
-                    [Yy][Ee][Ss])
-                        _remove_files="${_remove_files} ${_f}"
-                        ;;
-                esac
+                TRIGGER_FILES="${TRIGGER_FILES} ${_f}"
             fi
         done
 
@@ -152,12 +148,14 @@
 
             # Remove trigger files if configured to do so
             if [ ${rc} -eq 0 ]; then
-                if [ -n "${_remove_files}" ]; then
-                    echo "Removing trigger files${profilestr} ..."
-                    for _rf in ${_remove_files}; do
-                        rm -fv "${_rf}"
-                    done
-                fi
+                case "${daily_local_triggered_action_files_remove}" in
+                    [Yy][Ee][Ss])
+                        echo "Removing trigger files${profilestr} ..."
+                        for _rf in ${TRIGGER_FILES}; do
+                            rm -fv "${_rf}"
+                        done
+                        ;;
+                esac
             fi
         else
             echo "No action triggers found${profilestr}"