Open nickvergessen opened 6 years ago
We would be even happy to show a notification to all or users of selected groups in a top bar, e.g. for scheduled maintenance announcements.
We would be even happy to show a notification to all or users of selected groups in a top bar, e.g. for scheduled maintenance announcements.
I used this command-line oneliner for this purpose
sudo -u www-data php /path/to/nextcloud/occ user:list | sed 's/.*- \(.*\):.*/\1/' | xargs -l -i sudo -u www-data php /path/to/nextcloud/occ notification:generate {} "System maintenance today starting at 4 PM"
Hate to necro things like this but this would be very helpful.
@t2d Thanks for your script, that did the trick. Would still love to see this feature added.
We would be even happy to show a notification to all or users of selected groups in a top bar, e.g. for scheduled maintenance announcements.
I used this command-line oneliner for this purpose
sudo -u www-data php /path/to/nextcloud/occ user:list | sed 's/.*- \(.*\):.*/\1/' | xargs -l -i sudo -u www-data php /path/to/nextcloud/occ notification:generate {} "System maintenance today starting at 4 PM"
This is very nice script!!! I suggest to remove -l
option in xargs
command and add -l "Body text"
:
sudo -u www-data php /path/to/nextcloud/occ user:list | sed 's/.*- \(.*\):.*/\1/' | xargs -i sudo -u www-data php /path/to/nextcloud/occ notification:generate -l "Body text" {} "Header"
I also elaborated sending messages to a certain group on the base of occ group:list
command on the base of your findings.
My suggestion is to use the following sed
sentence:
sed -En '/^[[:space:]]*-[[:space:]]<groupname>.$/,/^[[:space:]]{2}-[[:space:]][^-]/{/^[[:space:]]*-[[:space:]]/{s/^[[:space:]]{4}-[[:space:]]//p}; /^[[:space:]]*-[[:space:]]/d}'
So, the final script will look like this:
php ./occ group:list | \
sed -En '/^[[:space:]]*-[[:space:]]<groupname>.$/,/^[[:space:]]{2}-[[:space:]][^-]/{/^[[:space:]]*-[[:space:]]/{s/^[[:space:]]{4}-[[:space:]]//p}; /^[[:space:]]*-[[:space:]]/d}' | \
xargs -i php ./occ notification:generate -l "Body of the message" {} "Header of the message"
Copied from https://github.com/nextcloud/admin_notifications/issues/4
Both from console and OCS
Maybe also "all users that logged in" too: https://github.com/nextcloud/admin_notifications/issues/5