• 2 Posts
  • 5 Comments
Joined 4 months ago
cake
Cake day: June 22nd, 2026

help-circle
  • 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.


  • For me, WebDAV is just a workaround, since it’s the only way I can sync files even without Wi-Fi and while on the go. But here’s an idea: Is there a way to send some kind of webhook to Nextcloud that would trigger the scan? Then, after editing in Roundcube or running an rsync, I could send a REST request that would initiate the scan. Since I developed the Roundcube plugin myself, I can integrate that whenever I want and, if necessary, delay it to capture multiple changes. Of course, this only works if there’s a corresponding feature in Nextcloud.