comparison etc/periodic/daily/720.local-triggered-action @ 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 8c7f686ef66f
comparison
equal deleted inserted replaced
400:357887df56f5 401:d2796c709dcf
111 111
112 echo 112 echo
113 echo "Testing for newly triggered action${profilestr}" 113 echo "Testing for newly triggered action${profilestr}"
114 114
115 _do_action="" 115 _do_action=""
116 _remove_files="" 116 TRIGGER_FILES=""
117 117
118 for _f in ${daily_local_triggered_action_files}; do 118 for _f in ${daily_local_triggered_action_files}; do
119 if [ -r "${_f}" ]; then 119 if [ -r "${_f}" ]; then
120 _do_action="yes" 120 _do_action="yes"
121 case "${daily_local_triggered_action_files_remove}" in 121 TRIGGER_FILES="${TRIGGER_FILES} ${_f}"
122 [Yy][Ee][Ss])
123 _remove_files="${_remove_files} ${_f}"
124 ;;
125 esac
126 fi 122 fi
127 done 123 done
128 124
129 if [ "${_do_action}" = "yes" ]; then 125 if [ "${_do_action}" = "yes" ]; then
130 if [ -z "${daily_local_triggered_action_action}" ]; then 126 if [ -z "${daily_local_triggered_action_action}" ]; then
150 rc=$? 146 rc=$?
151 fi 147 fi
152 148
153 # Remove trigger files if configured to do so 149 # Remove trigger files if configured to do so
154 if [ ${rc} -eq 0 ]; then 150 if [ ${rc} -eq 0 ]; then
155 if [ -n "${_remove_files}" ]; then 151 case "${daily_local_triggered_action_files_remove}" in
156 echo "Removing trigger files${profilestr} ..." 152 [Yy][Ee][Ss])
157 for _rf in ${_remove_files}; do 153 echo "Removing trigger files${profilestr} ..."
158 rm -fv "${_rf}" 154 for _rf in ${TRIGGER_FILES}; do
159 done 155 rm -fv "${_rf}"
160 fi 156 done
157 ;;
158 esac
161 fi 159 fi
162 else 160 else
163 echo "No action triggers found${profilestr}" 161 echo "No action triggers found${profilestr}"
164 fi 162 fi
165 ;; 163 ;;