[smartmontools/f15/master] notify users when disk is failing
Michal Hlavinka
mhlavink at fedoraproject.org
Thu Feb 17 16:14:57 UTC 2011
commit 93628aa393221cea0c6ee86bf1296fab4e9756c7
Author: Michal Hlavinka <mhlavink at redhat.com>
Date: Thu Feb 17 17:14:59 2011 +0100
notify users when disk is failing
smartdnotify | 9 +++++++++
smartmontools-5.38-defaultconf.patch | 2 +-
smartmontools.spec | 11 +++++++++--
3 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/smartdnotify b/smartdnotify
new file mode 100644
index 0000000..b03ae26
--- /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" >/dev/null 2>&1 ||:
+
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 <mhlavink at redhat.com> - 1:5.40-6
+- notify users when disk is failing
+
* Wed Feb 09 2011 Michal Hlavinka <mhlavink at redhat.com> - 1:5.40-5
- move to systemd
More information about the scm-commits
mailing list