add an AIO outdated notification

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2022-11-17 13:38:09 +01:00
parent bdcd4fc240
commit de137f70ae
5 changed files with 92 additions and 2 deletions

View file

@ -41,6 +41,9 @@ while true; do
# Check for updates and send notification if yes
sudo -u www-data php /var/www/docker-aio/php/src/Cron/UpdateNotification.php
# Check if AIO is outdated
sudo -u www-data php /var/www/docker-aio/php/src/Cron/OutdatedNotification.php
# Remove sessions older than 24h
find "/mnt/docker-aio-config/session/" -mindepth 1 -mmin +1440 -delete

View file

@ -227,12 +227,14 @@ RUN set -ex; \
COPY start.sh /
COPY notify.sh /
COPY notify-all.sh /
RUN set -ex; \
chmod +x /start.sh && \
chmod +x /entrypoint.sh && \
chmod +r /upgrade.exclude && \
chmod +x /cron.sh && \
chmod +x /notify.sh && \
chmod +x /notify-all.sh && \
chmod +x /activate-collabora.sh
RUN set -ex; \

View file

@ -0,0 +1,27 @@
#!/bin/bash
if [[ "$EUID" = 0 ]]; then
COMMAND=(sudo -E -u www-data php /var/www/html/occ)
else
COMMAND=(php /var/www/html/occ)
fi
SUBJECT="$1"
MESSAGE="$2"
if [ "$("${COMMAND[@]}" config:app:get notifications enabled)" = "no" ]; then
echo "Cannot send notification as notification app is not enabled."
exit 1
fi
echo "Posting notifications to all users..."
NC_USERS=$("${COMMAND[@]}" user:list | sed 's|^ - ||g' | sed 's|:.*||')
mapfile -t NC_USERS <<< "$NC_USERS"
for user in "${NC_USERS[@]}"
do
echo "Posting '$SUBJECT' to: $user"
"${COMMAND[@]}" notification:generate "$user" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE"
done
echo "Done!"
exit 0