mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Initial import
This commit is contained in:
commit
2295a33590
884 changed files with 93939 additions and 0 deletions
29
Containers/nextcloud/notify.sh
Normal file
29
Containers/nextcloud/notify.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
SUBJECT="$1"
|
||||
MESSAGE="$2"
|
||||
|
||||
if [ "$(php /var/www/html/occ config:app:get notificaations enabled)" = "no" ]; then
|
||||
echo "Cannot send notification as notification app is not enabled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Posting notifications to users that are admins..."
|
||||
NC_USERS=$(php /var/www/html/occ user:list | sed 's|^ - ||g' | sed 's|:.*||')
|
||||
mapfile -t NC_USERS <<< "$NC_USERS"
|
||||
for user in "${NC_USERS[@]}"
|
||||
do
|
||||
if php /var/www/html/occ user:info "$user" | cut -d "-" -f2 | grep -x -q " admin"
|
||||
then
|
||||
NC_ADMIN_USER+=("$user")
|
||||
fi
|
||||
done
|
||||
|
||||
for admin in "${NC_ADMIN_USER[@]}"
|
||||
do
|
||||
echo "Posting '$SUBJECT' to: $admin"
|
||||
php /var/www/html/occ notification:generate "$admin" "$NC_DOMAIN: $SUBJECT" -l "$MESSAGE"
|
||||
done
|
||||
|
||||
echo "Done!"
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue