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>2019-01-15 05:06:59 +0300
committernachoparker <nacho@ownyourbits.com>2019-01-15 05:09:04 +0300
commit6fb9c9b9063698824c9b1d0dec1a87a087b8db16 (patch)
tree4e3fb52ca1389b57d5bdba0294888057bfb733d9
parent9b1ecbb8d605ddded41ed011653b213d4b9b03da (diff)
nc-hdd-test: try to detect device type if auto doesnt workv1.3.5
-rw-r--r--bin/ncp/SYSTEM/nc-hdd-monitor.sh9
-rw-r--r--bin/ncp/SYSTEM/nc-hdd-test.sh17
-rw-r--r--changelog.md6
3 files changed, 24 insertions, 8 deletions
diff --git a/bin/ncp/SYSTEM/nc-hdd-monitor.sh b/bin/ncp/SYSTEM/nc-hdd-monitor.sh
index 562074a4..e88efa3b 100644
--- a/bin/ncp/SYSTEM/nc-hdd-monitor.sh
+++ b/bin/ncp/SYSTEM/nc-hdd-monitor.sh
@@ -57,7 +57,14 @@ sudo -u www-data php /var/www/nextcloud/occ notification:generate \
EOF
chmod +x /usr/local/etc/ncp-hdd-notif.sh
- for dr in "${DRIVES[@]}"; do smartctl --smart=on /dev/${dr} | sed 1,2d; done
+ for dr in "${DRIVES[@]}"; do
+ local type=""
+ smartctl -d test /dev/${dr} &>/dev/null || {
+ smartctl -d sat -i /dev/${dr} &>/dev/null && type="-d sat"
+ }
+ smartctl $type --smart=on /dev/${dr} | sed 1,2d;
+ done
+
update-rc.d smartd enable
service smartd start
echo "HDD monitor enabled"
diff --git a/bin/ncp/SYSTEM/nc-hdd-test.sh b/bin/ncp/SYSTEM/nc-hdd-test.sh
index b9d8330f..ced4a597 100644
--- a/bin/ncp/SYSTEM/nc-hdd-test.sh
+++ b/bin/ncp/SYSTEM/nc-hdd-test.sh
@@ -31,18 +31,25 @@ configure()
}
for dr in "${DRIVES[@]}"; do
+
+ local type=""
+ smartctl -d test /dev/${dr} &>/dev/null || {
+ smartctl -d sat -i /dev/${dr} &>/dev/null || { echo "couldnt detect device type"; return 1; }
+ type="-d sat"
+ }
+
smartctl --smart=on /dev/${dr} | sed 1,2d
if [[ "$SHORTTEST" == yes ]]; then
echo "* Starting test on $dr. Check results later"
- smartctl -X "/dev/$dr" &>/dev/null
- smartctl -t short "/dev/$dr" | sed 1,2d
+ smartctl $type -X "/dev/$dr" &>/dev/null
+ smartctl $type -t short "/dev/$dr" | sed 1,2d
elif [[ "$LONGTEST" == yes ]]; then
echo "* Starting test on $dr. Check results later"
- smartctl -X "/dev/$dr" &>/dev/null
- smartctl -t long "/dev/$dr" | sed 1,2d
+ smartctl $type -X "/dev/$dr" &>/dev/null
+ smartctl $type -t long "/dev/$dr" | sed 1,2d
else
echo "* Stats for $dr"
- smartctl -a "/dev/$dr" | sed 1,2d
+ smartctl $type -a "/dev/$dr" | sed 1,2d
fi
done
}
diff --git a/changelog.md b/changelog.md
index af5fa352..ba00783c 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,9 @@
-[v1.3.4](https://github.com/nextcloud/nextcloudpi/commit/63e0561) (2019-01-14) nc-info: fix automount reporting
+[v1.3.5](https://github.com/nextcloud/nextcloudpi/commit/7697a4d) (2019-01-14) nc-hdd-test: try to detect device type if auto doesnt work
-[v1.3.3](https://github.com/nextcloud/nextcloudpi/commit/389ed0c) (2019-01-14) nc-ramlog: adapt to armbian
+[v1.3.4](https://github.com/nextcloud/nextcloudpi/commit/9b1ecbb) (2019-01-14) nc-info: fix automount reporting
+
+[v1.3.3 ](https://github.com/nextcloud/nextcloudpi/commit/389ed0c) (2019-01-14) nc-ramlog: adapt to armbian
[v1.3.2 ](https://github.com/nextcloud/nextcloudpi/commit/be9a546) (2019-01-14) nc-automount: fix description