dockcheck/notify_templates/notify_file.sh
vorezal 31a45f1d84
Add file notification channel (#222)
* Add file notification channel

* Bypass file channel notifications for dockcheck.sh script

* Implement notification channel template reuse and advanced configuration variables.

* Fix text insertion formatting for dockcheck script and container updates.

* Fix dockcheck.sh notification csv and text output.

* Fix ntfy variable references and replace tr for uppercase conversion.

* Fix ALLOWEMPTY logic, undefined snippet case, and README formatting.

* Refactor notification send/skip logic. Adjust missing variable return codes.

* Adjust notifications README section for clarity and readability.

---------

Co-authored-by: Matthew Oleksowicz <matt@everyoneneeds.it>
2025-09-15 11:25:23 +02:00

22 lines
716 B
Bash

### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
NOTIFY_FILE_VERSION="v0.1"
#
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
trigger_file_notification() {
if [[ -n "$1" ]]; then
file_channel="$1"
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$file_channel")
else
file_channel="file"
UpperChannel="FILE"
fi
FilePathVar="${UpperChannel}_PATH"
NotifyFile="${!FilePathVar:=${ScriptWorkDir}/updates_available.txt}"
echo "${MessageBody}" > ${NotifyFile}
}