21 users online | 21 Guests and 0 Registered

Hard drive failure notification


cd /root
nano hd-monitor.sh
#!/usr/bin/perl
$to='some@yourown.com';
$from='hdfail@whatever.com';
my $command_output = ´/usr/sbin/smartctl -a /dev/sda1´;
if ($command_output =~ /PASSED/ && $? == 0) {
print "No issues with /dev/sda1";
}else{
´echo "Subject:HD Failure \n$command_output" | /usr/sbin/sendmail -f $from $to´;
}
sudo chmod +x /root/hd-monitor.sh
sudo crontab -e
0 3 * * * /root/hd-monitor.sh  > /tmp/hd-monitor.log
Tags: failure, Hard drive, notification, SMART
Last update:
2016-01-26 06:13
Author:
Revision:
1.5
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags

Sticky FAQs