From 098dac6bf5454d116825aa81773f29f5145b252d Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Feb 17 2011 16:04:48 +0000 Subject: notify users when disk is failing --- diff --git a/smartdnotify b/smartdnotify new file mode 100644 index 0000000..664b8a1 --- /dev/null +++ b/smartdnotify @@ -0,0 +1,9 @@ +#! /bin/sh + +# Send mail +echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS" + +# Notify desktop user +/usr/bin/notify-send -t 0 "WARNING: Your hard drive is failing" +"Description: +$SMARTD_MESSAGE" diff --git a/smartmontools-5.38-defaultconf.patch b/smartmontools-5.38-defaultconf.patch index 6762b7b..28d382b 100644 --- a/smartmontools-5.38-defaultconf.patch +++ b/smartmontools-5.38-defaultconf.patch @@ -6,7 +6,7 @@ diff -up smartmontools-5.38/smartd.conf.defaultconf smartmontools-5.38/smartd.co # are found. Most users should comment out DEVICESCAN and explicitly # list the devices that they wish to monitor. -DEVICESCAN -+DEVICESCAN -H -m root -n standby,10,q ++DEVICESCAN -H -m root -M exec /usr/lib/smartd_actions -n standby,10,q # Alternative setting to ignore temperature and power-on hours reports # in syslog. diff --git a/smartmontools.spec b/smartmontools.spec index 5d63457..b954feb 100644 --- a/smartmontools.spec +++ b/smartmontools.spec @@ -1,7 +1,7 @@ Summary: Tools for monitoring SMART capable hard disks Name: smartmontools Version: 5.40 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 1 Group: System Environment/Base License: GPLv2+ @@ -10,6 +10,7 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Source1: smartd.initd Source2: smartmontools.sysconf Source3: smartd.service +Source4: smartdnotify #fedora/rhel specific Patch1: smartmontools-5.38-defaultconf.patch @@ -19,7 +20,8 @@ Patch2: smartmontools-5.40-megaraid.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Requires: fileutils mailx chkconfig -Requires(triggerun): systemd-units +#new rpm does not handle this (yet?) +#Requires(triggerun): systemd-units Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units @@ -66,6 +68,7 @@ rm -f examplescripts/Makefile* chmod a-x -R examplescripts/* install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/lib/systemd/system/smartd.service +install -D -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT/%{_libexecdir}/%{name}/smartdnotify rm -rf $RPM_BUILD_ROOT/etc/{rc.d,init.d} rm -rf $RPM_BUILD_ROOT/%{_docdir}/%{name} @@ -109,9 +112,13 @@ fi %{_sbindir}/update-smart-drivedb %{_sbindir}/smartctl %{_mandir}/man?/smart*.* +%{_libexecdir}/%{name}/smartdnotify %{_datadir}/%{name}/drivedb.h %changelog +* Thu Feb 17 2011 Michal Hlavinka - 1:5.40-6 +- notify users when disk is failing + * Wed Feb 09 2011 Michal Hlavinka - 1:5.40-5 - move to systemd