• Joel

Setting up iNotifyScan for your Nextcloud server

Updated: Apr 19


Prerequisites

You'll need to have completed the following guide before completing this tutorial:

Introduction

In this guide we'll show you how to install iNotifyScan on your Nextcloud server. iNotifyScan is an essential tool, if you're using SMB shares to connect to your Nextcloud data locally. Without iNotifyScan installed, files that you create in an SMB share will not appear in the Nextcloud web interface, or the app, because the database doesn't know that you've added a file. The same applies to editing or deleting files and folders. iNotifyScan runs in the background with a low footprint; regulary scanning for changes in the data directories of your Nextcloud users.


Let's get started...

Installing iNotifyScan

Run the following commands to install iNotifyScan:

$ cd /home/pi
$ sudo apt-get update
$ git clone https://github.com/Blaok/nextcloud-inotifyscan; cd nextcloud-inotifyscan
$ sudo make install

You'll also need to download and install iNotifyTools:

$ sudo apt-get install inotify-tools

Configuring iNotifyScan

We now need to configure the directories that iNotifyScan monitors. To do this you'll need to create a configuration file by typing the following command:

$ sudo nano /etc/nextcloud-inotifyscan/www-data.ini

Now paste in the text below. In the user option, list all of the users of your Nextcloud, of which will be accessing their files via SMB shares. In our example, it's just the Admin user. Save the file by pressing <Ctrl> + x followed by y and then press <Enter>:

# The DEFAULT section sets global defaults for a nextcloud-inotifyscan daemon.
[DEFAULT]

# interval: seconds until the next polling if no change is found; defaults to 1.
interval = 1

# Each non-DEFAULT section specifies info for a nextcloud instance; name of
# sections must be unique; otherwise only the last one will be used.
[Instance1]

# occ: path to the nextcloud occ script; in docker this is typicall just "occ".
occ = /var/www/nextcloud/occ

# user: the nextcloud users to watch changes for, comma separated.
user = Admin

# docker: username:container of the docker, or no.
docker = no

# external_storage: whether to watch external storages. Defaults to no.
external_storage = no

In our experience, when the Pi boots, iNotifyScan runs before the Nextcloud database is up and running, therefore it fails and never runs. To solve this, we created a timer file, which delays the service from running until 1 minute after boot. To do this run the following command:

$ sudo nano /etc/systemd/system/nextcloud-inotifyscan@.timer

Now enter the following test and save the file by pressing <Ctrl> + x followed by y and then press <Enter>:

[Timer]
OnBootSec=1min

sudo systemctl status nextcloud-inotifyscan@www-data

Finally enable the iNotifyScan service for boot and run now:

$ sudo systemctl enable --now nextcloud-inotifyscan@www-data

*Note: if you want to view the status of the service, you can run the following:

$ sudo systemctl status nextcloud-inotifyscan@www-data

26 views
  • Facebook
  • Instagram

©2020 by BitProof Web design