#!/bin/bash # Monitor HDD health automatically # # Copyleft 2018 by Ignacio Nunez Hernanz # GPL licensed (see end of file) * Use at your own risk! # # More at https://ownyourbits.com # is_active() { systemctl -q is-enabled smartd &>/dev/null } configure() { local DRIVES=($(lsblk -ln | grep "^sd[[:alpha:]].*disk" | awk '{ print $1 }')) [[ ${#DRIVES[@]} == 0 ]] && { echo "no drives detected. Disabling.." } [[ "$ACTIVE" != yes ]] && { systemctl disable smartd systemctl stop smartd echo "HDD monitor disabled" return 0 } cat > /etc/smartd.conf < /usr/local/etc/ncp-hdd-notif.sh <> /usr/local/etc/ncp-hdd-notif.sh <> /usr/local/etc/ncp-hdd-notif.sh <