NextCloud – the sequel.

All I can say is WOW, NextCloud (NC) rocks.! I wrote the last post in 2018 and it’s now late 2020 and the NextCloud server is still cranking on a Raspberry Pi.

I’ve done one upgrade to NC and that went smoothly. Webdav was a touch slow, so I went back to SAMBA. Especially for communal data running in a NAS. When adding data from your LAN via SAMBA the NextCloud database does not see the new files. Thus I made a simple shell script to run nightly to update the NextCloud database.

--------------------- filescan.sh - START
    # Last updated by DP 31st March 2020
    #!/bin/bash
    cd /var/www/html/
    sudo -u www-data php occ files:scan --path="shared/files/"
--------------------- filescan.sh - END

Create it with root permissions.
Set the permissions to make it executable.

chmod 500 filescan.sh

Test it.

./filescan.sh

Should return something like

 Starting scan for user 1 out of 1 (%user_name%)
 +---------+--------+--------------+
 | Folders | Files  | Elapsed time |
 +---------+--------+--------------+
 | 8069    | 186532 | 01:52:36     |
 +---------+--------+--------------+ 

Use

crontab -e

to add

02   03 *   *   * /var/www/html/filescan.sh

to cron to run filescan.sh at 03:02 daily.

It should take 20-25mins for 5k files’ish.

I still use Rsync to do second and third backups to offsite drives, but as far as a reliable, easy, cross-platform, cross-device system, it’s by far the best I’ve used.

Leave a Reply