mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
add an AIO outdated notification
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
bdcd4fc240
commit
de137f70ae
5 changed files with 92 additions and 2 deletions
|
|
@ -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; \
|
||||
|
|
|
|||
27
Containers/nextcloud/notify-all.sh
Normal file
27
Containers/nextcloud/notify-all.sh
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue