Notification Push

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • [Nextcloud Hub 10] (31.0.5)
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.63
  • PHP version (e.g, 8.3):
    • PHP 8.3.21
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare Metal
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Hello,

I’m looking for a solution to my notification problem (GitHub - nextcloud/notify_push: Update notifications for nextcloud clients).

I use Nextcloud to access my data from anywhere outside of work.
When I’m at work, I use SMB shares (Samba4).
So far, nothing complicated.

I’m now trying to get notifications working when a user makes changes to the server via SMB in multiple folders accessible to multiple users. (I use this: GitHub - klemens-u/nextcloud-inotify: When a file is created/changed/deleted in the filesystem (e.g. over Samba) run Nextcloud file scanning for the parent directory efficently. Otherwise the updates would not be recognized by Nextcloud).

The watcher works, however, updates don’t seem to be happening.


Modify: /data/testdata/image001 (copy).png
Unknown user 1 testdata

±--------±------±----±--------±--------±-------±-------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
±--------±-----±----±--------±--------±-------±-------------+
| 0 | 0 | 0 | 0 | 0 | 00:00:00 |
±--------±------±----±--------±-------±-------±-------------+


testdata is a Samba share accessible by multiple users (user1, user2, user3, etc.)

Is there a way to notify all users of the update via push?

Thank you for your feedback.

there are two different aspects you need to handle:

  • Nextcloud needs to detect the file change
  • Nextcloud should inform users about this change

I would start with the first one - review the web UI while changing some files - if the created/modified date changes first step works (you can use occ as well - there is a commend like files:info or similar). Once this works continue with push - review you notification settings at {cloud uri}/settings/user/notifications and check Push for “A file or folder has been modified

then you should start receiving “notifications” (look at bell icon top right in the web UI) once the file is modified, by default it takes some time. Adding notify_push to the system makes this notifications arrive faster/instant on each client mobile/desktop/web.. push notifications to mobile is another story (but works well by default).

You have many custom parts in your system - I would start with simple setup like local storage and maybe file shared from one user to another and move further once you work out the simple step.

Thank you for your reply.

What I’m trying to set up is a push notification system so that when a file is modified on samba, I get an almost instant update, as nextcloud doesn’t intervene at this level.

Currently, the push notification system works but is very slow.

For example:
±--------±-------±----±--------±--------±-------±-------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
±--------±-------±----±--------±--------±-------±-------------+
| 2112139 | 737938 | 0 | 22189 | 53 | 23 | 01:42:15 |
±--------±-------±----±--------±--------±-------±-------------+

This is just a small part of the files to be scanned.

If I want to make an update when a modification is made, it is then possible to pass the information via :

occ files:scan -v --shallow --path=${SCAN_PATH}

This is where I want to notify users who are part of a group.

In absolute terms, I know how to retrieve group users by :

occ group:list | sed -En '/^[[:space:]]*-[[:space:]]GroupName.$/,/^[[:space:]]{2}-[[:space:]][^-]/{/^[[:space:]]*-[[:space:]]/{s/^[[:space:]]{4}-[[:space:]]//p}; /^[[:space:]]*-[[:space:]]/d}'

Is there an option in: occ files:scan that would notify the users in question?

occ files:scan is not intended to notify users. The goal is to make the system aware of outside changes.
It looks you run the scan against many files and folders - this is likely the reason why it is slow. use a smaller scope (from inotify you should know the folder/file exactly) so the scan completes faster. if the folder is such big the you must separate the data into smaller chunks or get rid of external storage and switch to internal storage. you can also try to consume SMB update notifications maybe it works for you

occ can output results as json which you can parse easier using jq command (or any programming language)