Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
GAS85 committed Jun 24, 2019
1 parent b15377c commit 16e8900
Showing 1 changed file with 12 additions and 39 deletions.
51 changes: 12 additions & 39 deletions README.md
Expand Up @@ -3,12 +3,12 @@
for Apache A+ SSL configuration check https://gist.github.com/GAS85/42a5469b32659a0aecc60fa2d4990308

## Table of content:
- [nextcloud-scripts-config.conf](https://github.com/GAS85/nextcloud_scripts#nextcloud-scripts-configconf)
- [nextcloud-file-sync.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-file-syncsh)
- [nextcloud-preview.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-previewsh)
- [nextcloud-rsync-to-remote.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-rsync-to-remotesh)
- [nextcloud-system-notification.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-system-notificationsh)
- [nextcloud-usage-report.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-usage-reportsh)
- [nextcloud-scripts-config.conf](https://github.com/GAS85/nextcloud_scripts#nextcloud-scripts-configconf) - Configuration file
- [nextcloud-file-sync.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-file-syncsh) - Do External Shares rescan only
- [nextcloud-preview.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-previewsh) - Automate preview generation
- [nextcloud-rsync-to-remote.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-rsync-to-remotesh) - Do data Folder rsync to remote via SSH with key Authentication, or into archive
- [nextcloud-system-notification.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-system-notificationsh) - Get System Notifications into Nextcloud
- [nextcloud-usage-report.sh](https://github.com/GAS85/nextcloud_scripts#nextcloud-usage-reportsh) - Generate report in cacti format

---

Expand All @@ -26,13 +26,13 @@ Central configuration file, very handy if you are using more then one script fro
Basically it works out from the box. Only that you have to check you nextcloud path, log path and create a log file for `php occ` output.
Will do external ONLY shares rescan for nextcloud.

I put it in
Put it in

/usr/local/bin/

with `chmod 755`

I run it under _nextcloud user_ (for me it is www-data) basically twice per day at 2:30 and 14:30. You can run it also hourly. This is my cron config:
Run it under _nextcloud user_ (for me it is www-data) basically twice per day at 2:30 and 14:30. You can run it also hourly. This is my cron config:

30 2,14 * * * perl -e 'sleep int(rand(1800))' && /usr/local/bin/nextcloud-file-sync.sh #Nextcloud file sync

Expand All @@ -42,7 +42,7 @@ Here I add _perl -e 'sleep int(rand(1800))'_ to inject some random start time wi

_If you would like to perform WHOLE nextcloud re-scan, please add -all to command, e.g.:_

> ./nextcloud-file-sync.sh -all
./nextcloud-file-sync.sh -all

Lets go through what it does (valid for [commit 44d9d2f](https://github.com/GAS85/nextcloud_scripts/commit/44d9d2ffe1153130560c8039e1299483bc2a36a5)):

Expand All @@ -56,29 +56,7 @@ Lets go through what it does (valid for [commit 44d9d2f](https://github.com/GAS8
> CRONLOGFILE=/var/log/next-cron.log **<-- location for bash log. In case when there is an output by command generated. AND IT IS GENERATED...**

Line 22 will generate NC log input. You will see it in a GUI as:
![](https://help.nextcloud.com/uploads/default/original/2X/e/ebd7635c409b67d3ee0144246e4ca93f2363540a.png)

From the line 26 starts the job, basically it is left from an older version of script and it is exactly what you done - scan all users, all shares, all locals with all folders. It takes ages to perform an a big installations, so I commented it.

Second option (line 31) is to scan for specific user, but as soon as I get more than one user with external shares it does not work also. Besides it is still scanning whole partition (local and remote) for specific user - commented.

From line 35 till 42 comments how to not forget how I get users from the NC, basically everything is happens in line 45, script will generate exactly path for external shares to be updated for all users (you can run it and test output). Here an example command:

sudo -u www-data php occ files_external:list | awk -F'|' '{print $8"/files"$3}'| tail -n +4 | head -n -1 | awk '{gsub(/ /, "", $0); print}'

and output:

user1/files/Dropbox-user1
user2/files/Dropbox-user2
user1/files/MagentaCloud
user2/files/MagentaCloud
user1/files/Local-Folder

Those lines will be read one by one and synced in line 49.

After this script will generate NC log output:
Script will generate NC log output:
![](https://help.nextcloud.com/uploads/default/original/2X/b/bfc2a6ad6de3d7af5d287776e87ffbcd5d6fcc18.png)

I have had some issues (like described here https://help.nextcloud.com/t/occ-files-cleanup-does-it-delete-the-db-table-entries-of-the-missing-files/20253) in older NC versions, so I added workaround from line 60 till 67 as `files:cleanup` command, nut sure if it is needed now, but it does not harm anything.
Expand Down Expand Up @@ -118,12 +96,7 @@ You only have to specify user from the Administrator group to get notifications
### nextcloud-usage-report.sh
This script works with https://apps.nextcloud.com/apps/user_usage_report

Will generate report and output it in cacti format
Supports Argument as _"user"_ if you need to check statistic for one user only
run _./nextcloud-usage_report.sh user_ to get specific user information
AS-IS without any warranty

output fields are:
Will generate report and output it in cacti format. Supports Argument as _"user"_ if you need to check statistic for one user only run _./nextcloud-usage_report.sh user_ to get specific user information.
AS-IS without any warranty. Output fields are:

storage_all, storage_used, shares_new, files_all, files_new, files_read

0 comments on commit 16e8900

Please sign in to comment.