Im using a External Storage folder to hold my markdown notes. I only use them sporadically via Nextcloud and view/change them mostly via external applications. But i have to rely on the Nextcloud WebDAV sync to sync the to some devices. When i now change such a note externally, this change doesnt sync to the devices. Nextcloud means, that the files have not changed. Only when I open one of the edited notes the change will be detected, and then the WebDAV sync works.

In the adminpanel i have set the option for this external storage in “Check for changes” to “Once every direct access”. I can also set it to “Never”. Both settings are documented. But there is also a setting “Ever”. This is not documented in https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/external_storage_configuration_gui.html

Unfortunately, “Always” doesn’t necessarily mean “Immediately.” When I select “Always,” the WebDAV sync still hasn’t completed even after 10 minutes.

So where does this “Always” come from if it’s not documented anywhere, and what does it mean? And even more importantly, how do I get a WebDAV sync to work after making a change? Do I really have to run occ files_external:scan <id> every few seconds?

  • INeedMana@piefed.zip
    link
    fedilink
    English
    arrow-up
    1
    ·
    16 days ago

    I don’t think the scan is somehow exposed via API. But maybe NC flow could be set up for that?
    There’s also NC ExApps. And I guess you might set something like that using push. Either ntfy or NC push

    • MoLoPoLY@feddit.orgOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      16 days ago

      Many thx. As a workaround, i have now created 2 systemd units:

      Service Unit: nc_scanfolder.service

      [Unit]
      Description=Starts scanning the folder
      After=network.target
      
      [Service]
      Type=oneshot
      User=www-data
      ExecStartPre=/usr/bin/sleep 10
      ExecStart=/usr/bin/php /var/www/nextcloud/occ files:scan --path="/username/files/folder"
      

      and Path Unit: nc_scanfolder.path

      [Unit]
      Description=Checks for changes
      
      [Path]
      PathChanged=/mnt/external/storage/folder
      Unit=nc_scanfolder.service
      TriggerLimitIntervalSec=30
      TriggerLimitBurst=1
      
      [Install]
      WantedBy=multi-user.target
      

      This works fine so far. If a file changes in this folder, the scan will be initialized. To prevent running the scan to often for to much changes, i have added a delay of 10 seconds in the service unit and a burst limit in the path unit. With this, multiple changes are bundled in 1 scan. At least, its a workaround. I dont know if there are better ways to do this.