Skip to content

Commit

Permalink
nc-hdd-monitor: fix detection
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
nachoparker committed Jul 6, 2019
1 parent e3cab9b commit 53d02fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
24 changes: 14 additions & 10 deletions bin/ncp/SYSTEM/nc-hdd-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@ configure()
}

[[ "$ACTIVE" != yes ]] && {
update-rc.d smartd disable
service smartd stop
systemctl disable smartd
service smartd stop
echo "HDD monitor disabled"
return 0
}

cat > /etc/smartd.conf <<EOF
# short scan every day at 1am, long one on sundays at 2am
DEVICESCAN -a -m $EMAIL -M exec /usr/local/etc/ncp-hdd-notif.sh -s (S/../.././01|L/../../7/02)
EOF

cat > /usr/local/etc/ncp-hdd-notif.sh <<EOF
#!/bin/bash
EOF
Expand All @@ -57,16 +52,25 @@ sudo -u www-data php /var/www/nextcloud/occ notification:generate \
EOF
chmod +x /usr/local/etc/ncp-hdd-notif.sh

cat > /etc/smartd.conf <<EOF
# short scan every day at 1am, long one on sundays at 2am
EOF

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;
smartctl ${type} --smart=on /dev/${dr} | sed 1,2d;

cat >> /etc/smartd.conf <<EOF
/dev/${dr} -a ${type} -m ${EMAIL} -M exec /usr/local/etc/ncp-hdd-notif.sh -s (S/../.././01|L/../../7/02)
EOF

done

update-rc.d smartd enable
service smartd start
systemctl enable smartd
service smartd start
echo "HDD monitor enabled"
}

Expand Down
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

[v1.14.0](https://github.com/nextcloud/nextcloudpi/commit/22e9dca) (2019-07-05) upgrade to NC16.0.2
[v1.14.2](https://github.com/nextcloud/nextcloudpi/commit/60898da) (2019-07-06) nc-hdd-monitor: fix detection

[v1.13.6](https://github.com/nextcloud/nextcloudpi/commit/88da901) (2019-06-29) ncp-update: fixes on the new step based upgrade system
[v1.14.0 ](https://github.com/nextcloud/nextcloudpi/commit/fa9ddca) (2019-07-05) upgrade to NC16.0.2

[v1.13.6 ](https://github.com/nextcloud/nextcloudpi/commit/88da901) (2019-06-29) ncp-update: fixes on the new step based upgrade system

[v1.13.5 ](https://github.com/nextcloud/nextcloudpi/commit/fbdab43) (2019-06-29) ncp-web: adjust ipv6 local restrictions

Expand Down

0 comments on commit 53d02fe

Please sign in to comment.