Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2017-04-11 22:49:18 +0300
committernachoparker <nacho@ownyourbits.com>2017-04-12 08:17:02 +0300
commit47f4c75391bc0ef8c687958f050ddc117613773a (patch)
tree86130ef49951a57a54e8032b5cb06a17ef5e63a6 /etc/nextcloudpi-config.d/nc-scan-auto.sh
parent714f6b2a79576d2c9f967d3cab4d9311fe889d1a (diff)
NFS and nc-scanv0.6.0
Diffstat (limited to 'etc/nextcloudpi-config.d/nc-scan-auto.sh')
-rwxr-xr-xetc/nextcloudpi-config.d/nc-scan-auto.sh83
1 files changed, 83 insertions, 0 deletions
diff --git a/etc/nextcloudpi-config.d/nc-scan-auto.sh b/etc/nextcloudpi-config.d/nc-scan-auto.sh
new file mode 100755
index 00000000..0f495959
--- /dev/null
+++ b/etc/nextcloudpi-config.d/nc-scan-auto.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# Periodically synchronize NextCloud for externally modified files
+# Tested with 2017-03-02-raspbian-jessie-lite.img
+#
+# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
+# GPL licensed (see end of file) * Use at your own risk!
+#
+# Usage:
+#
+# ./nc-scan-auto.sh
+#
+# See installer.sh instructions for details
+# More at: https://ownyourbits.com
+#
+
+SCANINTERVAL_=60
+DESCRIPTION="Periodically scan NC for externally modified files"
+
+configure()
+{
+ whiptail --msgbox \
+ --backtitle "NextCloudPi configuration" \
+ --title "Instructions for auto synchronization" \
+"Set the time in minutes in SCANINTERVAL. \n
+>>> If there are too many files this can greatly affect performance. <<< \n
+SCANINTERVAL=0 will disable periodic synchronization." \
+ 20 90
+
+ [[ $SCANINTERVAL_ == 0 ]] && {
+ systemctl stop nc-scan.timer
+ systemctl disable nc-scan.timer
+ return 0
+ }
+
+ cat > /etc/systemd/system/nc-scan.timer <<EOF
+ [Unit]
+ Description=Timer to scan NC for externally modified files
+
+ [Timer]
+ OnBootSec=${SCANINTERVAL_}min
+ OnUnitActiveSec=${SCANINTERVAL_}min
+ Unit=nc-scan.service
+
+ [Install]
+ WantedBy=timers.target
+EOF
+ cat > /etc/systemd/system/nc-scan.service <<EOF
+[Unit]
+Description=Scan NC for externally modified files
+
+[Service]
+Type=simple
+ExecStart=/usr/local/bin/ncp-scan
+
+[Install]
+WantedBy=default.target
+EOF
+ systemctl daemon-reload
+ systemctl enable nc-scan.timer
+ systemctl start nc-scan.timer
+}
+
+install() { :; }
+cleanup() { :; }
+
+# License
+#
+# This script is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This script is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+# Boston, MA 02111-1307 USA
+