if disks.count > 0
package "smartmontools"
+ template "/usr/local/bin/smartd-mailer" do
+ source "smartd-mailer.erb"
+ owner "root"
+ group "root"
+ mode 0755
+ end
+
template "/etc/smartd.conf" do
source "smartd.conf.erb"
owner "root"
--- /dev/null
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+case "$SMARTD_DEVICETYPE" in
+ areca,*) [ "$SMARTD_FAILTYPE" = "FailedOpenDevice" ] && exit 0
+esac
+
+exec mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS <<EOF
+$SMARTD_FULLMESSAGE
+EOF
<% @disks.each do |disk| -%>
<% if disk[:driver] -%>
-/dev/<%= disk[:device] %> -d <%= disk[:driver] %>,<%= disk[:id] %> -s S/../../7/02 -m admins@openstreetmap.org
+/dev/<%= disk[:device] %> -d <%= disk[:driver] %>,<%= disk[:id] %> -s S/../../7/02 -m admins@openstreetmap.org -M exec /usr/local/bin/smartd-mailer
<% else -%>
-/dev/<%= disk[:device] %> -s S/../../7/02 -m admins@openstreetmap.org
+/dev/<%= disk[:device] %> -s S/../../7/02 -m admins@openstreetmap.org -M exec /usr/local/bin/smartd-mailer
<% end -%>
<% end -%>