Official read only mirror of the smartmontools project SVN https://www.smartmontools.org/browser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
smartmontools/smartmontools/smartd.conf.5.in

1762 lines
68 KiB

.ig
Copyright (C) 2002-10 Bruce Allen
Copyright (C) 2004-22 Christian Franke
SPDX-License-Identifier: GPL-2.0-or-later
$Id$
..
.\" Macros borrowed from pages generated with Pod::Man
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp 0.4v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Use groff extension \(aq (apostrophe quote, ASCII 0x27) if possible
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH SMARTD.CONF 5 "CURRENT_SVN_DATE" "CURRENT_SVN_VERSION" "SMART Monitoring Tools"
.SH NAME
\fBsmartd.conf\fP \- SMART Disk Monitoring Daemon Configuration File\fP
.Sp
.SH DESCRIPTION
.\" %IF NOT OS ALL
.\"! [This man page is generated for the OS_MAN_FILTER version of smartmontools.
.\"! It does not contain info specific to other platforms.]
.\"! .PP
.\" %ENDIF NOT OS ALL
\fB/usr/local/etc/smartd.conf\fP is the configuration file for the \fBsmartd\fP
daemon.
.PP
If the configuration file \fB/usr/local/etc/smartd.conf\fP is present,
\fBsmartd\fP reads it at startup.
If \fBsmartd\fP subsequently receives a \fBHUP\fP signal,
it will then re-read the configuration file. If \fBsmartd\fP is
running in debug mode, then an \fBINT\fP signal will also make it
re-read the configuration file. This signal can be generated by typing
\fB<CONTROL-C>\fP in the terminal window where \fBsmartd\fP is
running.
.PP
In the absence of a configuration file
\fBsmartd\fP will try to open all available devices
(see \fBsmartd\fP(8) man page).
A configuration file with a single line \fB\*(AqDEVICESCAN \-a\*(Aq\fP
would have the same effect.
.PP
This can be annoying if you have an ATA or SCSI device that hangs or
misbehaves when receiving SMART commands. Even if this causes no
problems, you may be annoyed by the string of error log messages about devices
that can't be opened.
.PP
One can avoid this problem, and gain more control over the types of
events monitored by
\fBsmartd\fP,
by using the configuration file
.B /usr/local/etc/smartd.conf.
This file contains a list of devices to monitor, with one device per
line. An example file is included with the
.B smartmontools
distribution. You will find this sample configuration file in
\fB/usr/local/share/doc/smartmontools/\fP.
For security, the configuration file should not be writable by anyone
but root.
The syntax of the file is as follows:
.IP \(bu 4
There should be one device listed per line, although you may have
lines that are entirely comments or white space.
.IP \(bu 4
Any text following a hash sign \*(Aq#\*(Aq and up to the end of the line is
taken to be a comment, and ignored.
.IP \(bu 4
Lines may be continued by using a backslash \*(Aq\e\*(Aq as the last
non-whitespace or non-comment item on a line.
.IP \(bu 4
Note: a line whose first character is a hash sign \*(Aq#\*(Aq is treated as
a white-space blank line, \fBnot\fP as a non-existent line, and will
\fBend\fP a continuation line.
.PP
Here is an example configuration file. It's for illustrative purposes
only; please don't copy it onto your system without reading to the end
of the
.B DIRECTIVES
Section below!
.PP
.Vb 9
################################################
# This is an example smartd startup config file
# /usr/local/etc/smartd.conf
#
# On the second disk, start a long self-test every
# Sunday between 3 and 4 am.
#
/dev/sda \-a \-m admin@example.com,root@localhost
/dev/sdb \-a \-I 194 \-I 5 \-i 12 \-s L/../../7/03
#
# Send a TEST warning email to admin on startup.
#
/dev/sdc \-m admin@example.com \-M test
#
# Strange device. It's SCSI. Start a scheduled
# long self test between 5 and 6 am Monday/Thursday
/dev/weird \-d scsi \-s L/../../(1|4)/05
#
# An ATA disk may appear as a SCSI device to the
# OS. If a SCSI to ATA Translation (SAT) layer
# is between the OS and the device then this can be
# flagged with the '\-d sat' option. This situation
# may become common with SATA disks in SAS and FC
# environments.
/dev/sda \-a \-d sat
.\" %IF OS FreeBSD Linux
#
# Disks connected to a MegaRAID controller
# Start short self\-tests daily between 1\-2, 2\-3, and
# 3\-4 am.
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS Linux
# Linux:
/dev/sda \-d megaraid,0 \-a \-s S/../.././01
/dev/sda \-d megaraid,1 \-a \-s S/../.././02
/dev/sda \-d megaraid,2 \-a \-s S/../.././03
/dev/bus/0 \-d megaraid,2 \-a \-s S/../.././03
.\" %ENDIF OS Linux
.\" %IF OS FreeBSD
# FreeBSD:
/dev/mfi0 \-d megaraid,0 \-a \-s S/../.././01
/dev/mfi0 \-d megaraid,1 \-a \-s S/../.././02
/dev/mfi0 \-d megaraid,2 \-a \-s S/../.././03
/dev/mrsas0 \-d megaraid,2 \-a \-s S/../.././03
.\" %ENDIF OS FreeBSD
.\" %IF OS Linux
#
# Three disks connected to an AacRaid controller
# Start short self\-tests daily between 1\-2, 2\-3, and
# 3\-4 am.
/dev/sda \-d aacraid,0,0,66 \-a \-s S/../.././01
/dev/sda \-d aacraid,0,0,67 \-a \-s S/../.././02
/dev/sda \-d aacraid,0,0,68 \-a \-s S/../.././03
.\" %ENDIF OS Linux
.\" %IF OS FreeBSD Linux
#
# Two SATA (not SAS) disks on a 3ware 9750 controller.
# Start long self\-tests Sundays between midnight and
# 1 am and 2\-3 am
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS Linux
# under Linux
/dev/twl0 \-d 3ware,0 \-a \-s L/../../7/00
/dev/twl0 \-d 3ware,1 \-a \-s L/../../7/02
.\" %ENDIF OS Linux
.\" %IF OS FreeBSD
# under FreeBSD
/dev/tws0 \-d 3ware,0 \-a \-s L/../../7/00
/dev/tws0 \-d 3ware,1 \-a \-s L/../../7/02
.\" %ENDIF OS FreeBSD
.\" %IF OS FreeBSD Linux
#
# Three SATA disks on a HighPoint RocketRAID controller.
# Start short self\-tests daily between 1\-2, 2\-3, and
# 3\-4 am.
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS Linux
# under Linux
/dev/sde \-d hpt,1/1 \-a \-s S/../.././01
/dev/sde \-d hpt,1/2 \-a \-s S/../.././02
/dev/sde \-d hpt,1/3 \-a \-s S/../.././03
.\" %ENDIF OS Linux
.\" %IF OS FreeBSD
# under FreeBSD
/dev/hptrr \-d hpt,1/1 \-a \-s S/../.././01
/dev/hptrr \-d hpt,1/2 \-a \-s S/../.././02
/dev/hptrr \-d hpt,1/3 \-a \-s S/../.././03
.\" %ENDIF OS FreeBSD
.\" %IF OS FreeBSD Linux
#
# Two SATA disks connected to a HighPoint RocketRAID
# via a pmport device. Start long self\-tests Sundays
# between midnight and 1 am and 2\-3 am.
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS Linux
# under Linux
/dev/sde \-d hpt,1/4/1 \-a \-s L/../../7/00
/dev/sde \-d hpt,1/4/2 \-a \-s L/../../7/02
.\" %ENDIF OS Linux
.\" %IF OS FreeBSD
# under FreeBSD
/dev/hptrr \-d hpt,1/4/1 \-a \-s L/../../7/00
/dev/hptrr \-d hpt,1/4/2 \-a \-s L/../../7/02
.\" %ENDIF OS FreeBSD
.\" %IF OS FreeBSD Linux
#
# Three SATA disks connected to an Areca
# RAID controller. Start long self\-tests Sundays
# between midnight and 3 am.
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS Linux
# under Linux
/dev/sg2 \-d areca,1 \-a \-s L/../../7/00
/dev/sg2 \-d areca,2 \-a \-s L/../../7/01
/dev/sg2 \-d areca,3 \-a \-s L/../../7/02
.\" %ENDIF OS Linux
.\" %IF OS FreeBSD
# under FreeBSD
/dev/arcmsr0 \-d areca,1 \-a \-s L/../../7/00
/dev/arcmsr0 \-d areca,2 \-a \-s L/../../7/01
/dev/arcmsr0 \-d areca,3 \-a \-s L/../../7/02
.\" %ENDIF OS FreeBSD
.\" %IF OS Linux
#
# Two SATA disks on an Intelliprop controller.
# Start short self\-tests daily between 1\-2, 2\-3, and
# 3\-4 am.
/dev/sde \-d intelliprop,0+sat \-a \-s S/../.././01
/dev/sde \-d intelliprop,1+sat \-a \-s S/../.././02
.\" %ENDIF OS Linux
#
# The following line enables monitoring of the
# ATA Error Log and the Self\-Test Error Log.
# It also tracks changes in both Prefailure
# and Usage Attributes, apart from Attributes
# 9, 194, and 231, and shows continued lines:
#
/dev/sdd\ \-l\ error\ \e
\ \ \ \ \ \-l\ selftest\ \e
\ \ \ \ \ \-t\ \e\ \ \ \ \ \ \ \ \ # Attributes not tracked:
\ \ \ \ \ \-I\ 194\ \e\ \ \ \ \ # temperature
\ \ \ \ \ \-I\ 231\ \e\ \ \ \ \ # also temperature
\ \ \ \ \ \-I\ 9\ \ \ \ \ \ \ \ \ # power\-on hours
#
################################################
.Ve
.Sp
.SH DEVICESCAN
If a non-comment entry in the configuration file is the text string
.B DEVICESCAN
in capital letters, then
\fBsmartd\fP
will ignore any remaining lines in the configuration file, and will
scan for devices.
If
.B DEVICESCAN
is not followed by any Directives, then \*(Aq\-a\*(Aq will apply to all
devices.
.PP
.B DEVICESCAN
may optionally be followed by Directives that will apply to all
devices that are found in the scan.
For example
.PP
.Vb
\ \ DEVICESCAN \-m root@example.com
.Ve
.PP
will scan for all devices, and then monitor them.
It will send one email warning per device for any problems that are found.
.PP
.Vb
\ \ DEVICESCAN \-H \-m root@example.com
.Ve
.PP
will do the same, but only monitors the SMART health status of the
devices, rather than the default \*(Aq\-a\*(Aq.
.PP
Multiple \*(Aq\-d TYPE\*(Aq options may be specified with DEVICESCAN
to combine the scan results of more than one TYPE.
.PP
Configuration entries for specific devices may precede the \fBDEVICESCAN\fP
entry.
For example
.PP
.Vb 4
\ \ DEFAULT \-m root@example.com
\ \ /dev/sda \-s S/../.././02
\ \ /dev/sdc \-d ignore
\ \ DEVICESCAN \-s L/../.././02
.Ve
.PP
will scan for all devices except /dev/sda and /dev/sdc, monitor them, and
run a long test between 2\(en3 am every morning.
Device /dev/sda will also be monitored, but only a short test will be run.
Device /dev/sdc will be ignored.
Warning emails will be sent for all monitored devices.
.PP
A device is ignored by DEVICESCAN if a configuration line with the same
device name exists.
.\" %IF NOT OS Windows OS2
Symbolic links are resolved before this check is done.
.\" %ENDIF NOT OS Windows OS2
A device name is also ignored if another device with same identify
information (vendor, model, firmware version, serial number, WWN) already
exists.
.Sp
.SH DEFAULT SETTINGS
If an entry in the configuration file starts with
.B DEFAULT
instead of a device name, then all directives in this entry are set
as defaults for the next device entries.
.PP
This configuration:
.PP
.Vb 7
\ \ DEFAULT \-a \-R5! \-W 2,40,45 \-I 194 \-s L/../../7/00 \-m admin@example.com
\ \ /dev/sda
\ \ /dev/sdb
\ \ /dev/sdc
\ \ DEFAULT \-H \-m admin@example.com
\ \ /dev/sdd
\ \ /dev/sde \-d removable
.Ve
.PP
has the same effect as:
.PP
.Vb 5
\ \ /dev/sda \-a \-R5! \-W 2,40,45 \-I 194 \-s L/../../7/00 \-m admin@example.com
\ \ /dev/sdb \-a \-R5! \-W 2,40,45 \-I 194 \-s L/../../7/00 \-m admin@example.com
\ \ /dev/sdc \-a \-R5! \-W 2,40,45 \-I 194 \-s L/../../7/00 \-m admin@example.com
\ \ /dev/sdd \-H \-m admin@example.com
\ \ /dev/sde \-d removable \-H \-m admin@example.com
.Ve
.Sp
.SH CONFIGURATION FILE DIRECTIVES
The following are the Directives that may appear following the device
name or
.B DEVICESCAN
or
.B DEFAULT
on any line of the
.B /usr/local/etc/smartd.conf
configuration file. Note that
.B these are NOT command-line options for
\fBsmartd\fP.
The Directives below may appear in any order, following the device
name.
.PP
.B For an ATA device,
if no Directives appear, then the device will be monitored
as if the \*(Aq\-a\*(Aq Directive (monitor all SMART properties) had been given.
.PP
.B If a SCSI disk is listed,
it will be monitored at the maximum implemented level: roughly
equivalent to using the \*(Aq\-H \-l selftest\*(Aq options for an ATA disk.
So with the exception of \*(Aq\-d\*(Aq, \*(Aq\-m\*(Aq, \*(Aq\-l selftest\*(Aq,
\*(Aq\-s\*(Aq, and \*(Aq\-M\*(Aq, the Directives below are ignored for SCSI disks.
For SCSI disks, the \*(Aq\-m\*(Aq Directive sends a warning email if the SMART
status indicates a disk failure or problem, if the SCSI inquiry about disk
status fails, or if new errors appear in the self-test log.
.\" %IF OS FreeBSD Linux
.PP
.B If a 3ware controller is used
then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
/dev/twa?, /dev/twl? or /dev/tws?) must be listed, along with the
\*(Aq\-d 3ware,N\*(Aq Directive (see below).
The individual ATA disks hosted by the 3ware controller appear to \fBsmartd\fP
as normal ATA devices.
Hence all the ATA directives can be used for these disks (but see note below).
.PP
.B If an Areca controller is used
then the corresponding device (SCSI /dev/sg? on Linux or /dev/arcmsr0 on
FreeBSD) must be listed, along with the \*(Aq\-d areca,N\*(Aq Directive
(see below).
The individual SATA disks hosted by the Areca controller appear to \fBsmartd\fP
as normal ATA devices. Hence all the ATA directives can be used for
these disks. Areca firmware version 1.46 or later which supports
smartmontools must be used; Please see the \fBsmartctl\fP(8) man page
for further details.
.\" %ENDIF OS FreeBSD Linux
.TP
.B \-d TYPE
Specifies the type of the device.
The valid arguments to this directive are:
.Sp
.I auto
\- attempt to guess the device type from the device name or from
controller type info provided by the operating system or from
a matching USB ID entry in the drive database.
This is the default.
.Sp
.I ata
\- the device type is ATA. This prevents
\fBsmartd\fP
from issuing SCSI commands to an ATA device.
.Sp
.\" %IF NOT OS Darwin
.I scsi
\- the device type is SCSI. This prevents
\fBsmartd\fP
from issuing ATA commands to a SCSI device.
.Sp
.\" %ENDIF NOT OS Darwin
.\" %IF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.I nvme[,NSID]
\- the device type is NVM Express (NVMe).
The optional parameter NSID specifies the namespace id (in hex) passed
to the driver.
Use 0xffffffff for the broadcast namespace id.
The default for NSID is the namespace id addressed by the device name.
.Sp
.\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.\" %IF NOT OS Darwin
.I sat[,auto][,N]
\- the device type is SCSI to ATA Translation (SAT).
This is for ATA disks that have a SCSI to ATA Translation Layer (SATL)
between the disk and the operating system.
SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and
the other 16 bytes long. The default is the 16 byte variant which can be
overridden with either \*(Aq\-d sat,12\*(Aq or \*(Aq\-d sat,16\*(Aq.
.Sp
If \*(Aq\-d sat,auto\*(Aq is specified, device type SAT (for ATA/SATA disks)
is only used if the SCSI INQUIRY data reports a SATL (VENDOR: "ATA ").
Otherwise device type SCSI (for SCSI/SAS disks) is used.
.Sp
.I usbcypress
\- this device type is for ATA disks that are behind a Cypress USB to PATA
bridge. This will use the ATACB proprietary scsi pass through command.
The default SCSI operation code is 0x24, but although it can be overridden
with \*(Aq\-d usbcypress,0xN\*(Aq, where N is the scsi operation code,
you're running the risk of damage to the device or filesystems on it.
.Sp
.I usbjmicron[,p][,x][,PORT]
\- this device type is for SATA disks that are behind a JMicron USB to
PATA/SATA bridge.
The 48-bit ATA commands (required e.g.\& for \*(Aq\-l xerror\*(Aq, see below)
do not work with all of these bridges and are therefore disabled by default.
These commands can be enabled by \*(Aq\-d usbjmicron,x\*(Aq.
If two disks are connected to a bridge with two ports, an error message is
printed if no PORT is specified.
The port can be specified by \*(Aq\-d usbjmicron[,x],PORT\*(Aq where PORT is 0
(master) or 1 (slave). This is not necessary if the device uses a port
multiplier to connect multiple disks to one port. The disks appear under
separate /dev/ice names then.
CAUTION: Specifying \*(Aq,x\*(Aq for a device which does not support it results
in I/O errors and may disconnect the drive. The same applies if the specified
PORT does not exist or is not connected to a disk.
.Sp
The Prolific PL2507/3507 USB bridges with older firmware support a pass-through
command similar to JMicron and work with \*(Aq\-d usbjmicron,0\*(Aq.
Newer Prolific firmware requires a modified command which can be selected by
\*(Aq\-d usbjmicron,p\*(Aq.
Note that this does not yet support the SMART status command.
.Sp
.I usbprolific
\- this device type is for SATA disks that are behind a Prolific
PL2571/2771/2773/2775 USB to SATA bridge.
.Sp
.I usbsunplus
\- this device type is for SATA disks that are behind a SunplusIT USB to SATA
bridge.
.Sp
.I sntasmedia
\- [NEW EXPERIMENTAL SMARTD FEATURE]
this device type is for NVMe disks that are behind an ASMedia USB to NVMe
bridge.
.Sp
.I sntjmicron[,NSID]
\- this device type is for NVMe disks that are behind a JMicron USB to NVMe
bridge.
The optional parameter NSID specifies the namespace id (in hex) passed
to the driver.
The default namespace id is the broadcast namespace id (0xffffffff).
.Sp
.I sntrealtek
\- this device type is for NVMe disks that are behind a Realtek USB to NVMe
bridge.
.Sp
.\" %ENDIF NOT OS Darwin
.\" %IF OS Linux
.I marvell
\- [Linux only] interact with SATA disks behind Marvell chip-set
controllers (using the Marvell rather than libata driver).
.Sp
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS FreeBSD Linux
.I megaraid,N
\- [Linux and FreeBSD only] the device consists of one or more SCSI/SAS disks connected
to a MegaRAID controller. The non-negative integer N (in the range of 0 to
127 inclusive) denotes which disk on the controller is monitored.
This interface will also work for Dell PERC controllers.
In log files and email messages this disk will be identified as
megaraid_disk_XXX with XXX in the range from 000 to 127 inclusive.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS Linux Windows Cygwin
.I aacraid,H,L,ID
\- [Linux, Windows and Cygwin only] the device consists of one or more
SCSI/SAS or SATA disks connected to an AacRaid controller.
The non-negative integers H,L,ID (Host number, Lun, ID) denote which disk
on the controller is monitored.
In log files and email messages this disk will be identified as
aacraid_disk_HH_LL_ID.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.\" %ENDIF OS Linux Windows Cygwin
.\" %IF OS FreeBSD Linux
.I 3ware,N
\- [FreeBSD and Linux only] the device consists of one or more ATA disks
connected to a 3ware RAID controller. The non-negative integer N
(in the range from 0 to 127 inclusive) denotes which disk on the controller
is monitored.
In log files and email messages this disk will be identified as 3ware_disk_XXX
with XXX in the range from 000 to 127 inclusive.
.Sp
Note that while you may use \fBany\fP of the 3ware SCSI logical devices /dev/tw*
to address \fBany\fP of the physical disks (3ware ports), error and log
messages will make the most sense if you always list the 3ware SCSI
logical device corresponding to the particular physical disks.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.\" %ENDIF OS FreeBSD Linux
.\" %IF OS FreeBSD Linux Windows Cygwin
.I areca,N
\- [FreeBSD, Linux, Windows and Cygwin only] the device consists of one or
more SATA disks connected to an Areca SATA RAID controller.
The positive integer N (in the range from 1 to 24 inclusive) denotes which
disk on the controller is monitored.
In log files and email messages this disk will be identified as
areca_disk_XX with XX in the range from 01 to 24 inclusive.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.I areca,N/E
\- [FreeBSD, Linux, Windows and Cygwin only] the device consists of one
or more SATA or SAS disks connected to an Areca SAS RAID controller.
The integer N (range 1 to 128) denotes the channel (slot) and E (range
1 to 8) denotes the enclosure.
Important: This requires Areca SAS controller firmware version 1.51 or later.
.Sp
.\" %ENDIF OS FreeBSD Linux Windows Cygwin
.\" %IF OS FreeBSD Linux
.I cciss,N
\- [FreeBSD and Linux only] the device consists of one or more SCSI/SAS or
SATA disks connected to a cciss RAID controller.
The non-negative integer N (in the range from 0 to 15 inclusive) denotes
which disk on the controller is monitored.
In log files and email messages this disk will be identified as cciss_disk_XX
with XX in the range from 00 to 15 inclusive.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.I hpt,L/M/N
\- [FreeBSD and Linux only] the device consists of one or more ATA disks
connected to a HighPoint RocketRAID controller. The integer L is the
controller id, the integer M is the channel number, and the integer N
is the PMPort number if it is available. The allowed values of L are
from 1 to 4 inclusive, M are from 1 to 128 inclusive and N from 1 to 4
if PMPort available. And also these values are limited by the model
of the HighPoint RocketRAID controller.
In log files and email messages this disk will be identified as
hpt_X/X/X and X/X/X is the same as L/M/N, note if no N indicated, N set
to the default value 1.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.\" %ENDIF OS FreeBSD Linux
.I intelliprop,N[+TYPE]
\- the device consists of multiple ATA disks connected to an Intelliprop
controller.
The integer N is the port number from 0 to 3 of the ATA drive to be targeted.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.I jmb39x[\-q],N[,sLBA][,force][+TYPE]
\- the device consists of multiple SATA disks connected to a JMicron JMB39x
RAID port multiplier.
The suffix \*(Aq\-q\*(Aq selects a slightly different command variant used by
some QNAP NAS devices.
The integer N is the port number from 0 to 4.
Please see the \fBsmartctl\fP(8) man page for further details.
.Sp
.I jms56x,N[,sLBA][,force][+TYPE]
\- the device consists of multiple SATA disks connected to a JMicron JMS56x
USB to SATA RAID bridge.
See \*(Aqjmb39x...\*(Aq above for valid arguments.
.Sp
.I ignore
\- the device specified by this configuration entry should be ignored.
This allows one to ignore specific devices which are detected by a following
DEVICESCAN configuration line.
It may also be used to temporary disable longer multi-line configuration entries.
This Directive may be used in conjunction with the other \*(Aq\-d\*(Aq
Directives.
.Sp
.I removable
\- the device or its media is removable. This indicates to
\fBsmartd\fP
that it should continue (instead of exiting, which is the default
behavior) if the device does not appear to be present when
\fBsmartd\fP is started.
This directive also suppresses warning emails and repeated log messages
if the device is removed after startup.
This Directive may be used in conjunction with the other \*(Aq\-d\*(Aq
Directives.
.br
\fBWARNING: Removing a device and connecting a different one to same interface
is not supported and may result in bogus warnings until smartd is restarted.\fP
.TP
.B \-n POWERMODE[,N][,q]
[ATA only] This \*(Aqnocheck\*(Aq Directive is used to prevent a disk from
being spun-up when it is periodically polled by \fBsmartd\fP.
.Sp
ATA disks have five different power states. In order of increasing
power consumption they are: \*(AqOFF\*(Aq, \*(AqSLEEP\*(Aq,
\*(AqSTANDBY\*(Aq, \*(AqIDLE\*(Aq, and \*(AqACTIVE\*(Aq.
Typically in the OFF, SLEEP, and STANDBY modes the disk's platters are not
spinning.
But usually, in response to SMART commands issued by \fBsmartd\fP, the disk
platters are spun up.
So if this option is not used, then a disk which is in a low-power mode may
be spun up and put into a higher-power mode when it is periodically
polled by \fBsmartd\fP.
.Sp
Note that if the disk is in SLEEP mode when \fBsmartd\fP is started,
then it won't respond to \fBsmartd\fP commands, and so the disk won't
be registered as a device for \fBsmartd\fP to monitor. If a disk is in
any other low-power mode, then the commands issued by \fBsmartd\fP to
register the disk will probably cause it to spin-up.
.Sp
The \*(Aq\fB\-n\fP\*(Aq (nocheck) Directive specifies if \fBsmartd\fP's
periodic checks should still be carried out when the device is in a
low-power mode. It may be used to prevent a disk from being spun-up
by periodic \fBsmartd\fP polling. The allowed values of POWERMODE
are:
.Sp
.I never
\- \fBsmartd\fP will poll (check) the device regardless of its power
mode. This may cause a disk which is spun-down to be spun-up when
\fBsmartd\fP checks it. This is the default behavior if the '\-n'
Directive is not given.
.Sp
.I sleep
\- check the device unless it is in SLEEP mode.
.Sp
.I standby
\- check the device unless it is in SLEEP or STANDBY mode. In
these modes most disks are not spinning, so if you want to prevent
a laptop disk from spinning up each time that \fBsmartd\fP polls,
this is probably what you want.
.Sp
.I idle
\- check the device unless it is in SLEEP, STANDBY or IDLE mode.
In the IDLE state, most disks are still spinning, so this is probably
not what you want.
.Sp
Maximum number of skipped checks (in a row) can be specified by
appending positive number \*(Aq,N\*(Aq to POWERMODE (like
\*(Aq\-n standby,15\*(Aq).
After N checks are skipped in a row, powermode is ignored and the
check is performed anyway.
.Sp
When a periodic test is skipped, \fBsmartd\fP normally writes an
informal log message. The message can be suppressed by appending
the option \*(Aq,q\*(Aq to POWERMODE (like \*(Aq\-n standby,q\*(Aq).
This prevents a laptop disk from spinning up due to this message.
.Sp
Both \*(Aq,N\*(Aq and \*(Aq,q\*(Aq can be specified together.
.TP
.B \-T TYPE
Specifies how tolerant
\fBsmartd\fP
should be of SMART command failures. The valid arguments to this
Directive are:
.Sp
.I normal
\- do not try to monitor the disk if a mandatory SMART command fails, but
continue if an optional SMART command fails. This is the default.
.Sp
.I permissive
\- try to monitor the disk even if it appears to lack SMART
capabilities. This may be required for some old disks (prior to
ATA-3 revision 4) that implemented SMART before the SMART standards
were incorporated into the ATA/ATAPI Specifications.
[Please see the \fBsmartctl \-T\fP command-line option.]
.TP
.B \-o VALUE
[ATA only] Enables or disables SMART Automatic Offline Testing when
\fBsmartd\fP
starts up and has no further effect. The valid arguments to this
Directive are \fIon\fP and \fIoff\fP.
.Sp
The delay between tests is vendor-specific, but is typically four
hours.
.Sp
Note that SMART Automatic Offline Testing is \fBnot\fP part of the ATA
Specification. Please see the
.B smartctl \-o
command-line option documentation for further information about this
feature.
.TP
.B \-S VALUE
Enables or disables Attribute Autosave when \fBsmartd\fP
starts up and has no further effect. The valid arguments to this
Directive are \fIon\fP and \fIoff\fP. Also affects SCSI devices.
[Please see the \fBsmartctl \-S\fP command-line option.]
.TP
.B \-H
[ATA] Check the health status of the disk with the SMART RETURN
STATUS command.
If this command reports a failing health status, then disk
failure is predicted in less than 24 hours, and a message at loglevel
.B \*(AqLOG_CRIT\*(Aq
will be logged to syslog. [Please see the
.B smartctl \-H
command-line option.]
.\" %IF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.Sp
[NVMe] Checks the "Critical Warning" byte from the SMART/Health
Information log.
If any warning bit is set, a message at loglevel \fB\*(AqLOG_CRIT\*(Aq\fP
will be logged to syslog.
.\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.TP
.B \-l TYPE
Reports increases in the number of errors in one of three SMART logs. The
valid arguments to this Directive are:
.Sp
.I error
\- [ATA] report if the number of ATA errors reported in the Summary SMART
error log has increased since the last check.
.Sp
.\" %IF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.I error
\- [NVMe] report if the "Number of Error Information Log Entries" from the
SMART/Health Information log has increased since the last check.
.Sp
.\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.I xerror
\- [ATA] report if the number of ATA errors reported in the Extended
Comprehensive SMART error log has increased since the last check.
.Sp
If both \*(Aq\-l error\*(Aq and \*(Aq\-l xerror\*(Aq are specified, smartd
checks the maximum of both values.
.Sp
[Please see the \fBsmartctl \-l xerror\fP command-line option.]
.Sp
.\" %IF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.I xerror
\- [NVMe] same as \*(Aq\-l error\*(Aq.
.\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.Sp
.I selftest
\- report if the number of failed tests reported in the SMART
Self-Test Log has increased since the last check, or if the timestamp
associated with the most recent failed test has increased. Note that
such errors will \fBonly\fP be logged if you run self-tests on the
disk (and it fails a test!). Self-Tests can be run automatically by
\fBsmartd\fP: please see the \*(Aq\-s\*(Aq Directive below.
Self-Tests can also be run manually by using the \*(Aq\-t short\*(Aq
and \fB\*(Aq\-t\ long\*(Aq\fP options of \fBsmartctl\fP and the results of
the testing can be observed using the \fBsmartctl \*(Aq\-l\ selftest\*(Aq\fP
command-line option.
[Please see the \fBsmartctl \-l\fP and \fB\-t\fP command-line
options.]
.Sp
[ATA only] Failed self-tests outdated by a newer successful extended
self-test are ignored. The warning email counter is reset if the
number of failed self tests dropped to 0. This typically happens when
an extended self-test is run after all bad sectors have been reallocated.
.Sp
.I offlinests[,ns]
\- [ATA only] report if the Offline Data Collection status has changed
since the last check. The report will be logged as LOG_CRIT if the new
status indicates an error. With some drives the status often changes,
therefore \*(Aq\-l offlinests\*(Aq is not enabled by \*(Aq\-a\*(Aq Directive.
.\" %IF NOT OS Cygwin Windows
.\"! Appending ',ns' (no standby) to this directive is not implemented
.\"! on OS_MAN_FILTER.
.\" %ENDIF NOT OS Cygwin Windows
.\" %IF OS Cygwin Windows
.Sp
[Windows and Cygwin only] If \*(Aq,ns\*(Aq (no standby) is appended to this
directive, smartd disables system auto standby as long as an Offline
Data Collection is in progress. See \*(Aq\-l selfteststs,ns\*(Aq below.
.\" %ENDIF OS Cygwin Windows
.Sp
.I selfteststs[,ns]
\- [ATA only] report if the Self-Test execution status has changed
since the last check. The report will be logged as LOG_CRIT if the new
status indicates an error.
.\" %IF NOT OS Cygwin Windows
.\"! Appending ',ns' (no standby) to this directive is not implemented
.\"! on OS_MAN_FILTER.
.\" %ENDIF NOT OS Cygwin Windows
.\" %IF OS Cygwin Windows
.Sp
[Windows and Cygwin only] If \*(Aq,ns\*(Aq (no standby) is appended to this
directive, smartd disables system auto standby as long as a Self-Test
is in progress. This prevents that a Self-Test is aborted because the
OS sets the system to a standby/sleep mode when idle. Smartd check
interval (\*(Aq\-i\*(Aq option) should be shorter than the configured idle
timeout. Auto standby is not disabled if the system is running on
battery.
.\" %ENDIF OS Cygwin Windows
.Sp
.I scterc,READTIME,WRITETIME
\- [ATA only] sets the SCT Error Recovery Control settings to the specified
values (deciseconds) when \fBsmartd\fP starts up and has no further effect.
Values of 0 disable the feature, other values less than 65 are probably
not supported. For RAID configurations, this is typically set to
70,70 deciseconds.
[Please see the \fBsmartctl \-l scterc\fP command-line option.]
.TP
.B \-e NAME[,VALUE]
Sets non-SMART device settings when \fBsmartd\fP starts up and has no
further effect.
[Please see the \fBsmartctl \-\-set\fP command-line option.]
Valid arguments are:
.Sp
.I aam,[N|off]
\- [ATA only] Sets the Automatic Acoustic Management (AAM) feature.
.Sp
.I apm,[N|off]
\- [ATA only] Sets the Advanced Power Management (APM) feature.
.Sp
.I lookahead,[on|off]
\- [ATA only] Sets the read look-ahead feature.
.Sp
.I security-freeze
\- [ATA only] Sets ATA Security feature to frozen mode.
.Sp
.I standby,[N|off]
\- [ATA only] Sets the standby (spindown) timer and places the drive in the
IDLE mode.
.Sp
.I wcache,[on|off]
\- [ATA only] Sets the volatile write cache feature.
.Sp
.I dsn,[on|off]
\- [ATA only] Sets the DSN feature.
.TP
.B \-s REGEXP
Run Self-Tests or Offline Immediate Tests, at scheduled times. A
Self- or Offline Immediate Test will be run at the end of periodic
device polling, if all 12 characters of the string \fBT/MM/DD/d/HH\fP
match the extended regular expression \fBREGEXP\fP. Here:
.RS 7
.IP \fBT\fP 4
is the type of the test. The values that \fBsmartd\fP will try to
match (in turn) are: \*(AqL\*(Aq for a \fBL\fPong Self-Test, \*(AqS\*(Aq for a
\fBS\fPhort Self-Test, \*(AqC\*(Aq for a \fBC\fPonveyance Self-Test (ATA
only), and \*(AqO\*(Aq for an \fBO\fPffline Immediate Test (ATA only). As
soon as a match is found, the test will be started and no additional
matches will be sought for that device and that polling cycle.
.Sp
To run scheduled Selective Self-Tests, use \*(Aqn\*(Aq for \fBn\fPext span,
\*(Aqr\*(Aq to \fBr\fPedo last span, or \*(Aqc\*(Aq to \fBc\fPontinue with
next span or redo last span based on status of last test.
The LBA range is based on the first span from the last test.
See the \fBsmartctl \-t select,[next|redo|cont]\fP options for
further info.
.Sp
Some disks (e.g.\& WD) do not preserve the selective self test log across
power cycles. If state persistence (\*(Aq\-s\*(Aq option) is enabled, the last
test span is preserved by smartd and used if (and only if) the selective
self test log is empty.
.IP \fBMM\fP 4
is the month of the year, expressed with two decimal digits. The
range is from 01 (January) to 12 (December) inclusive. Do \fBnot\fP
use a single decimal digit or the match will always fail!
.IP \fBDD\fP 4
is the day of the month, expressed with two decimal digits. The
range is from 01 to 31 inclusive. Do \fBnot\fP
use a single decimal digit or the match will always fail!
.IP \fBd\fP 4
is the day of the week, expressed with one decimal digit. The
range is from 1 (Monday) to 7 (Sunday) inclusive.
.IP \fBHH\fP 4
is the hour of the day, written with two decimal digits, and given in
hours after midnight. The range is 00 (midnight to just before 1 am)
to 23 (11pm to just before midnight) inclusive. Do \fBnot\fP use a
single decimal digit or the match will always fail!
.RE
.\" The following two lines define a non-existent option.
.\" This resets the margin to the level prior to the '.RS ... .RE' block.
.TP
.B \&
If the regular expression contains substrings of the form \fB:NNN\fP
or \fB:NNN-LLL\fP, where NNN and LLL are three decimal digits, staggered
tests are enabled.
Then a test will also be run if all 16 (or 20) characters of the string
\fBT/MM/DD/d/HH:NNN\fP (or \fBT/MM/DD/d/HH:NNN-LLL\fP) match the regular
expression.
This check is done for up to seven \fB:NNN\fP or \fB:NNN-LLL\fP found in
the regular expression.
The time used for the check is adjusted to the past such that tests of
the first drive are not delayed, tests of the second drive are delayed
by NNN hours, tests of the third drive are delayed by 2*NNN hours, and
so on.
.br
If LLL is also specified, delays are limited to LLL hours by calculating
each individual delay as:
.br
\*(Aq((DRIVE_INDEX * NNN) mod (LLL + 1))\*(Aq.
.Sp
Some examples follow. In reading these, keep in mind that in extended
regular expressions a dot \fB\*(Aq.\*(Aq\fP matches any single character, and
a parenthetical expression such as \fB\*(Aq(A|B|C)\*(Aq\fP denotes any one
of the three possibilities \fBA\fP, \fBB\fP, or \fBC\fP.
.Sp
To schedule a short Self-Test between 2\(en3 am every morning, use:
.br
\fB \-s S/../.././02\fP
.br
To schedule a long Self-Test between 4\(en5 am every Sunday morning, use:
.br
\fB \-s L/../../7/04\fP
.br
To enable staggered tests with delays in three hour steps, use:
.br
\fB \-s L/../../7/04:003\fP
.br
To enable staggered tests with delays 0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8,
0, ... hours, use:
.br
\fB \-s L/../../7/04:003-010\fP
.br
To enable staggered tests with delays 0, 1, 2, ..., 9, 10, 0, ... hours,
use:
.br
\fB \-s L/../../7/04:001-010\fP
.br
To schedule a long Self-Test between 10\(en11 pm on the first and
fifteenth day of each month, use:
.br
\fB \-s L/../(01|15)/./22\fP
.br
To schedule an Offline Immediate test after every midnight, 6 am,
noon, and 6 pm, plus a Short Self-Test daily at 1\(en2 am and a Long
Self-Test every Saturday at 3\(en4 am, use:
.br
\fB \-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03)\fP
.br
To enable staggered Long Self-Tests with delays in three hour steps,
use:
.br
\fB \-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03:003)\fP
.br
If Long Self-Tests of a large disks take longer than the system uptime,
a full disk test can be performed by several Selective Self-Tests.
To setup a full test of a 1 TB disk within 20 days (one 50 GB span
each day), run this command once:
.nf
smartctl \-t select,0\-99999999 /dev/sda
.fi
To run the next test spans on Monday\(enFriday between 12\(en13 am, run smartd
with this directive:
.br
\fB \-s n/../../[1\-5]/12\fP
.Sp
Scheduled tests are run immediately following the regularly-scheduled
device polling, if the current local date, time, and test type, match
\fBREGEXP\fP. By default the regularly-scheduled device polling
occurs every thirty minutes after starting \fBsmartd\fP. Take caution
if you use the \*(Aq\-i\*(Aq option to make this polling interval more than
sixty minutes: the poll times may fail to coincide with any of the
testing times that you have specified with \fBREGEXP\fP. In this case
the test will be run following the next device polling.
.Sp
Before running an offline or self-test, \fBsmartd\fP checks to be sure
that a self-test is not already running. If a self-test \fBis\fP
already running, then this running self test will \fBnot\fP be
interrupted to begin another test.
.Sp
\fBsmartd\fP will not attempt to run \fBany\fP type of test if another
test was already started or run in the same hour.
.Sp
To avoid performance problems during system boot, \fBsmartd\fP will
not attempt to run any scheduled tests following the very first
device polling (unless \*(Aq\-q onecheck\*(Aq is specified).
.Sp
Each time a test is run, \fBsmartd\fP will log an entry to SYSLOG.
You can use these or the \*(Aq\-q showtests\*(Aq command-line option to verify
that you constructed \fBREGEXP\fP correctly. The matching order
(\fBL\fP before \fBS\fP before \fBC\fP before \fBO\fP) ensures that
if multiple test types are all scheduled for the same hour, the
longer test type has precedence. This is usually the desired behavior.
.Sp
If the scheduled tests are used in conjunction with state persistence
(\*(Aq\-s\*(Aq option), smartd will also try to match the hours since last
shutdown (or 90 days at most). If any test would have been started
during downtime, the longest (see above) of these tests is run after
second device polling.
.Sp
If the \*(Aq\-n\*(Aq directive is used and any test would have been started
during disk standby time, the longest of these tests is run when the
disk is active again.
.Sp
Unix users: please beware that the rules for extended regular
expressions [\fBregex\fP(7)] are \fBnot\fP the same as the rules for
file-name pattern matching by the shell [\fBglob\fP(7)]. \fBsmartd\fP will
issue harmless informational warning messages if it detects characters
in \fBREGEXP\fP that appear to indicate that you have made this
mistake.
.TP
.B \-m ADD
Send a warning email to the email address \fBADD\fP if the \*(Aq\-H\*(Aq,
\*(Aq\-l error\*(Aq, \*(Aq\-l xerror\*(Aq, \*(Aq\-l selftest\*(Aq,
\*(Aq\-f\*(Aq, \*(Aq\-C\*(Aq, \*(Aq\-U\*(Aq, or \*(Aq\-W\*(Aq Directives
detect a failure or a new error, or if a SMART command to the disk fails.
This Directive only works in conjunction with these other Directives
(or with the equivalent default \*(Aq\-a\*(Aq Directive).
.Sp
To prevent your email in-box from getting filled up with warning
messages, by default only a single warning and (depending on
\*(Aq\-s\*(Aq option) daily reminder emails will be sent for each of
the enabled alert types.
See the \*(Aq\-M\*(Aq Directive below for details.
.Sp
To send email to more than one user, please use the following "comma
separated" form for the address: \fBuser1@add1,user2@add2,...,userN@addN\fP
(with no spaces).
.Sp
To test that email is being sent correctly, use the \*(Aq\-M test\*(Aq
Directive described below to send one test email message on
\fBsmartd\fP
startup.
.Sp
By default, email is sent using the system \fBmail\fP(1) command.
In order that \fBsmartd\fP find this command (normally /usr/bin/mail) the
executable must be in the path of the shell or environment from which
\fBsmartd\fP
was started. If you wish to specify an explicit path to the mail
executable (for example /usr/local/bin/mail) or a custom script to
run, please use the \*(Aq\-M exec\*(Aq Directive below.
.Sp
.\" %IF OS Windows
[Windows only] On Windows, the \*(Aq\fBBlat\fP\*(Aq mailer
(<\fBhttp://blat.sourceforge.net/\fP>) is used by default.
This mailer uses a different command line syntax, see
\*(Aq\-M exec\*(Aq below.
.Sp
If the file EXEDIR/smartd_mailer.conf.ps1 is present and \*(Aq\-M exec\*(Aq
is not specified, the script smartd_mailer.ps1 is used instead.
This script uses the Send-MailMessage cmdlet to send mail.
See EXEDIR/smartd_mailer.conf.sample.ps1 for info about the format of
the configuration file.
.Sp
.\" %ENDIF OS Windows
Note also that there is a special argument
.B <nomailer>
which can be given to the \*(Aq\-m\*(Aq Directive in conjunction with the
\*(Aq\-M exec\*(Aq Directive.
Please see below for an explanation of its effect.
.Sp
If the mailer or the shell running it produces any STDERR/STDOUT
output, then a snippet of that output will be copied to SYSLOG. The
remainder of the output is discarded. If problems are encountered in
sending mail, this should help you to understand and fix them. If
you have mail problems, we recommend running \fBsmartd\fP in debug
mode with the \*(Aq\-d\*(Aq flag, using the \*(Aq\-M test\*(Aq Directive
described below.
.\" %IF ENABLE_SMARTDPLUGINDIR
.\" %IF NOT OS Windows
.Sp
If a word of the comma separated list has the form \*(Aq@plugin\*(Aq, a custom
script /usr/local/etc/smartd_warning.d/plugin is run and the word is
removed from the list before sending mail. The string \*(Aqplugin\*(Aq may
be any valid name except \*(AqALL\*(Aq.
If \*(Aq@ALL\*(Aq is specified, all scripts in /usr/local/etc/smartd_warning.d/*
are run instead.
This is handled by the script /usr/local/etc/smartd_warning.sh
(see also \*(Aq\-M exec\*(Aq below).
Plugin scripts without execute permission are silently ignored.
If any plugin script is missing or fails a with nonzero exit status, the warning
script exits immediately without sending mail.
.\" %ENDIF NOT OS Windows
.\" %ENDIF ENABLE_SMARTDPLUGINDIR
.\" %IF OS Windows
.Sp
[Windows only] If one of the following words are used as the first address
in the comma separated list, warning messages are sent via WTSSendMessage().
This displays message boxes on the desktops of the selected sessions.
Address \*(Aq\fBconsole\fP\*(Aq specifies the console session only,
\*(Aq\fBactive\fP\*(Aq specifies the console session and all active remote
sessions, and \*(Aq\fBconnected\fP\*(Aq specifies the console session and
all connected (active or waiting for login) remote sessions.
This is handled by the script EXEDIR/smartd_warning.cmd which runs
the tool EXEDIR/wtssendmsg.exe (see also \*(Aq\-M exec\*(Aq below).
.\" %ENDIF OS Windows
.TP
.B \-M TYPE
These Directives modify the behavior of the
\fBsmartd\fP
email warnings enabled with the \*(Aq\-m\*(Aq email Directive described above.
These \*(Aq\-M\*(Aq Directives only work in conjunction with the \*(Aq\-m\*(Aq
Directive and can not be used without it.
.Sp
Multiple \-M Directives may be given. If more than one of the
following three \-M Directives are given (example: \-M once \-M daily)
then the final one (in the example, \-M daily) is used.
.Sp
The valid arguments to the \-M Directive are (one of the following
three):
.Sp
.I once
\- send only one warning email for each type of disk problem detected. This
is the default unless state persistence (\*(Aq\-s\*(Aq option) is enabled.
.Sp
.I daily
\- send additional warning reminder emails, once per day, for each type
of disk problem detected. This is the default if state persistence
(\*(Aq\-s\*(Aq option) is enabled.
.Sp
.I diminishing
\- send additional warning reminder emails, after a one-day interval,
then a two-day interval, then a four-day interval, and so on for each
type of disk problem detected. Each interval is twice as long as the
previous interval.
.Sp
If a disk problem is no longer detected, the internal email counter is
reset. If the problem reappears a new warning email is sent immediately.
.Sp
In addition, one may add zero or more of the following Directives:
.Sp
.I test
\- send a single test email
immediately upon
\fBsmartd\fP
startup. This allows one to verify that email is delivered correctly.
Note that if this Directive is used,
\fBsmartd\fP
will also send the normal email warnings that were enabled with the
\*(Aq\-m\*(Aq Directive, in addition to the single test email!
.Sp
.I exec PATH
\- run the executable PATH instead of the default mail command, when
\fBsmartd\fP
needs to send email. PATH must point to an executable binary file or
script.
.\" %IF OS Windows
.Sp
[Windows only] The PATH may contain space characters.
Then it must be included in double quotes.
.\" %ENDIF OS Windows
.Sp
By setting PATH to point to a customized script, you can make
\fBsmartd\fP perform useful tricks when a disk problem is detected
(beeping the console, shutting down the machine, broadcasting warnings
to all logged-in users, etc.\&) But please be careful. \fBsmartd\fP
will \fBblock\fP until the executable PATH returns, so if your
executable hangs, then \fBsmartd\fP will also hang.
.\" %IF NOT OS Windows
Some sample scripts are included in
/usr/local/share/doc/smartmontools/examplescripts/.
.\" %ENDIF NOT OS Windows
.Sp
The exit status of the executable is recorded by \fBsmartd\fP in
SYSLOG.
The executable is not expected to write to STDOUT or STDERR.
If it does, then this is interpreted as indicating that
something is going wrong with your executable, and a fragment of this
output is logged to SYSLOG to help you to understand the problem.
Normally, if you wish to leave some record behind, the executable
should send mail or write to a file or device.
.Sp
Before running the executable, \fBsmartd\fP sets a number of
environment variables. These environment variables may be used to
control the executable's behavior. The environment variables
exported by \fBsmartd\fP are:
.RS 7
.IP \fBSMARTD_MAILER\fP 4
is set to the argument of \-M exec, if present or else to \*(Aqmail\*(Aq
(examples: /usr/local/bin/mail, mail).
.IP \fBSMARTD_DEVICE\fP 4
is set to the device path (example: /dev/sda).
.IP \fBSMARTD_DEVICETYPE\fP 4
is set to the device type specified by \*(Aq\-d\*(Aq directive or
\*(Aqauto\*(Aq if none.
.IP \fBSMARTD_DEVICESTRING\fP 4
is set to the device description.
It starts with SMARTD_DEVICE and may be followed by an optional controller
identification (example: /dev/sda [SAT]).
The string may contain a space and is NOT quoted.
.IP \fBSMARTD_DEVICEINFO\fP 4
is set to device identify information. It includes most of the info printed
by \fBsmartctl \-i\fP but uses a brief single line format.
This device info is also logged when \fBsmartd\fP starts up.
The string contains space characters and is NOT quoted.
.IP \fBSMARTD_FAILTYPE\fP 4
gives the reason for the warning or message email. The possible values that
it takes and their meanings are:
.br
\fIEmailTest\fP: this is an email test message.
.br
\fIHealth\fP: the SMART health status indicates imminent failure.
.br
\fIUsage\fP: a usage Attribute has failed.
.br
\fISelfTest\fP: the number of self-test failures has increased.
.br
\fIErrorCount\fP: the number of errors in the ATA error log has increased.
.br
\fICurrentPendingSector\fP: one of more disk sectors could not be
read and are marked to be reallocated (replaced with spare sectors).
.br
\fIOfflineUncorrectableSector\fP: during off-line testing, or self-testing,
one or more disk sectors could not be read.
.br
\fITemperature\fP: Temperature reached critical limit (see \-W directive).
.br
\fIFailedHealthCheck\fP: the SMART health status command failed.
.br
\fIFailedReadSmartData\fP: the command to read SMART Attribute data failed.
.br
\fIFailedReadSmartErrorLog\fP: the command to read the SMART error log failed.
.br
\fIFailedReadSmartSelfTestLog\fP: the command to read the SMART self-test log
failed.
.br
\fIFailedOpenDevice\fP: the open() command to the device failed.
.IP \fBSMARTD_ADDRESS\fP 4
is determined by the address argument ADD of the \*(Aq\-m\*(Aq Directive.
If ADD is \fB<nomailer>\fP, then \fBSMARTD_ADDRESS\fP is not set.
Otherwise, it is set to the comma-separated-list of email addresses
given by the argument ADD, with the commas replaced by spaces
(example:admin@example.com root). If more than one email address is
given, then this string will contain space characters and is NOT
quoted, so to use it in a shell script you may want to enclose it in
double quotes.
.\" %IF ENABLE_SMARTDPLUGINDIR
.\" %IF NOT OS Windows
.IP \fBSMARTD_ADDRESS_ORIG\fP 4
is set to the original value of \fBSMARTD_ADDRESS\fP with \*(Aq@plugin\*(Aq
strings still present.
If there are no such strings in the \*(Aq\-m\*(Aq Directive, this variable is
NOT set.
.\" %ENDIF NOT OS Windows
.\" %ENDIF ENABLE_SMARTDPLUGINDIR
.\" %IF OS Windows
.IP \fBSMARTD_ADDRCSV\fP 4
[Windows only] is set to a comma-separated list of the addresses from
SMARTD_ADDRESS.
.\" %ENDIF OS Windows
.IP \fBSMARTD_MESSAGE\fP 4
is set to the one sentence summary warning email message string from
\fBsmartd\fP.
This message string contains space characters and is NOT quoted. So to
use $SMARTD_MESSAGE in a shell script you should probably enclose it in
double quotes.
.\" %IF NOT OS Windows
.IP \fBSMARTD_FULLMESSAGE\fP 4
is set to the contents of the entire email warning message string from
\fBsmartd\fP.
This message string contains space and return characters and is NOT
quoted.
So to use $SMARTD_FULLMESSAGE in a shell script you should probably
enclose it in double quotes.
.\" %ENDIF NOT OS Windows
.\" %IF OS Windows
.IP \fBSMARTD_FULLMSGFILE\fP 4
[Windows only] is the path to a temporary file containing the full message.
The path may contain space characters and is NOT quoted.
The file is created by the smartd_warning.cmd script and removed when
the mailer or command exits.
.\" %ENDIF OS Windows
.IP \fBSMARTD_TFIRST\fP 4
is a text string giving the time and date at which the first problem
of this type was reported. This text string contains space characters
and no newlines, and is NOT quoted. For example:
.br
Sun Feb 9 14:58:19 2003 CST
.IP \fBSMARTD_TFIRSTEPOCH\fP 4
is an integer, which is the unix epoch (number of seconds since Jan 1,
1970) for \fBSMARTD_TFIRST\fP.
.IP \fBSMARTD_PREVCNT\fP 4
is an integer specifying the number of previous messages sent.
It is set to \*(Aq0\*(Aq for the first message.
.IP \fBSMARTD_NEXTDAYS\fP 4
is an integer specifying the number of days until the next message will be sent.
It it set to empty on \*(Aq\-M once\*(Aq and set to \*(Aq1\*(Aq on
\*(Aq\-M daily\*(Aq.
.RE
.\" The following two lines define a non-existent option.
.\" This resets the margin to the level prior to the '.RS ... .RE' block.
.TP
.B \&
If the \*(Aq\-m ADD\*(Aq Directive is given with a normal address argument,
then the executable pointed to by PATH will be run in a shell with
STDIN receiving the body of the email message, and with the same
command-line arguments:
.Vb 1
\ \ \-s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
.Ve
that would normally be provided to \*(Aqmail\*(Aq. Examples include:
.br
.B \-m user@home \-M exec /usr/bin/mail
.br
.B \-m admin@work \-M exec /usr/local/bin/mailto
.br
.B \-m root \-M exec /Example_1/shell/script/below
.Sp
.\" %IF OS Windows
[Windows only] On Windows, the syntax of the \*(Aq\fBBlat\fP\*(Aq mailer is
used (except for \*(Aq.ps1\*(Aq scripts):
.Vb 1
\ \ \- \-q \-subject "%SMARTD_SUBJECT%" \-to %SMARTD_ADDRCSV%
.Ve
.Sp
.\" %ENDIF OS Windows
If the \*(Aq\-m ADD\*(Aq Directive is given with the special address argument
.B <nomailer>
then the executable pointed to by PATH is run in a shell with
.B no
STDIN and
.B no
command-line arguments, for example:
.Vb 1
\ \ \-m <nomailer> \-M exec /Example_2/shell/script/below
.Ve
.Sp
.\" %IF OS Windows
[Windows only] If a PATH with extension \*(Aq.ps1\*(Aq is specified with
\*(Aq\-M exec\*(Aq, the script is run as follows with no STDIN, regardless
of \*(Aq\-m ADD\*(Aq setting:
.Vb 2
\ \ PowerShell -NoProfile -ExecutionPolicy Bypass ^
\ \ \ \ \ \ \ \ \ \ \ \ \ -Command ^& \*(Aq%SMARTD_MAILER%\*(Aq
.Ve
.Sp
.\" %ENDIF OS Windows
If the executable produces any STDERR/STDOUT output, then \fBsmartd\fP
assumes that something is going wrong, and a snippet of that output
will be copied to SYSLOG. The remainder of the output is then
discarded.
.Sp
Some EXAMPLES of scripts that can be used with the \*(Aq\-M exec\*(Aq
Directive are given below.
.\" %IF NOT OS Windows
Some sample scripts are also included in
/usr/local/share/doc/smartmontools/examplescripts/.
.\" %ENDIF NOT OS Windows
.Sp
The executable is run by the script
.\" %IF NOT OS Windows
/usr/local/etc/smartd_warning.sh.
.\" %ENDIF NOT OS Windows
.\" %IF OS ALL
(Windows: EXEDIR/smartd_warning.cmd)
.\" %ENDIF OS ALL
.\" %IF OS Windows
.\"! EXEDIR/smartd_warning.cmd.
.\" %ENDIF OS Windows
This script formats subject and full message based on SMARTD_MESSAGE and other
environment variables set by \fBsmartd\fP.
The environment variables
.\" %IF NOT OS Windows
SMARTD_SUBJECT and SMARTD_FULLMESSAGE
.\" %ENDIF NOT OS Windows
.\" %IF OS ALL
(Windows: SMARTD_SUBJECT, SMARTD_FULLMSGFILE and SMARTD_ADDRCSV)
.\" %ENDIF OS ALL
.\" %IF OS Windows
.\"! SMARTD_SUBJECT, SMARTD_FULLMSGFILE and SMARTD_ADDRCSV
.\" %ENDIF OS Windows
are set by the script before running the executable.
.TP
.B \-f
[ATA only] Check for \*(Aqfailure\*(Aq of any Usage Attributes. If these
Attributes are less than or equal to the threshold, it does NOT indicate
imminent disk failure. It "indicates an advisory condition where the usage
or age of the device has exceeded its intended design life period."
[Please see the \fBsmartctl \-A\fP command-line option.]
.TP
.B \-p
[ATA only] Report anytime that a Prefail Attribute has changed
its value since the last check. [Please see the
.B smartctl \-A
command-line option.]
.TP
.B \-u
[ATA only] Report anytime that a Usage Attribute has changed its value
since the last check. [Please see the
.B smartctl \-A
command-line option.]
.TP
.B \-t
[ATA only] Equivalent to turning on the two previous flags \*(Aq\-p\*(Aq
and \*(Aq\-u\*(Aq.
Tracks changes in \fIall\fP device Attributes (both Prefailure and
Usage). [Please see the \fBsmartctl\fP \-A command-line option.]
.TP
.B \-i ID
[ATA only] Ignore device Attribute number \fBID\fP when checking for failure
of Usage Attributes. \fBID\fP must be a decimal integer in the range
from 1 to 255. This Directive modifies the behavior of the \*(Aq\-f\*(Aq
Directive and has no effect without it.
.Sp
This is useful, for example, if you have a very old disk and don't
want to keep getting messages about the hours-on-lifetime Attribute
(usually Attribute 9) failing. This Directive may appear multiple
times for a single device, if you want to ignore multiple Attributes.
.TP
.B \-I ID
[ATA only] Ignore device Attribute \fBID\fP when tracking changes in the
Attribute values. \fBID\fP must be a decimal integer in the range
from 1 to 255. This Directive modifies the behavior of the \*(Aq\-p\*(Aq,
\*(Aq\-u\*(Aq, and \*(Aq\-t\*(Aq tracking Directives and has no effect
without one of them.
.Sp
This is useful, for example, if one of the device Attributes is the disk
temperature (usually Attribute 194 or 231). It's annoying to get reports
each time the temperature changes. This Directive may appear multiple
times for a single device, if you want to ignore multiple Attributes.
.TP
.B \-r ID[!]
[ATA only] When tracking, report the \fIRaw\fP value of Attribute \fBID\fP
along with its (normally reported) \fINormalized\fP value. \fBID\fP must
be a decimal integer in the range from 1 to 255. This Directive modifies
the behavior of the \*(Aq\-p\*(Aq, \*(Aq\-u\*(Aq, and \*(Aq\-t\*(Aq tracking
Directives and has no effect without one of them.
This Directive may be given multiple times.
.Sp
A common use of this Directive is to track the device Temperature
(often ID=194 or 231).
.Sp
If the optional flag \*(Aq!\*(Aq is appended, a change of the Normalized
value is considered critical. The report will be logged as LOG_CRIT
and a warning email will be sent if \*(Aq\-m\*(Aq is specified.
.TP
.B \-R ID[!]
[ATA only] When tracking, report whenever the \fIRaw\fP value of Attribute
\fBID\fP changes. (Normally \fBsmartd\fP only tracks/reports changes
of the \fINormalized\fP Attribute values.) \fBID\fP must be a decimal
integer in the range from 1 to 255. This Directive modifies the
behavior of the \*(Aq\-p\*(Aq, \*(Aq\-u\*(Aq, and \*(Aq\-t\*(Aq tracking
Directives and has no effect without one of them.
This Directive may be given multiple times.
.Sp
If this Directive is given, it automatically implies the \*(Aq\-r\*(Aq
Directive for the same Attribute, so that the Raw value of the
Attribute is reported.
.Sp
A common use of this Directive is to track the device Temperature
(often ID=194 or 231). It is also useful for understanding how
different types of system behavior affects the values of certain
Attributes.
.Sp
If the optional flag \*(Aq!\*(Aq is appended, a change of the Raw
value is considered critical. The report will be logged as
LOG_CRIT and a warning email will be sent if \*(Aq\-m\*(Aq is specified.
An example is \*(Aq\-R 5!\*(Aq to warn when new sectors are reallocated.
.TP
.B \-C ID[+]
[ATA only] Report if the current number of pending sectors is
non-zero. Here \fBID\fP is the id number of the Attribute whose raw
value is the Current Pending Sector count. The allowed range of
\fBID\fP is 0 to 255 inclusive. To turn off this reporting, use
ID\ =\ 0. If the \fB\-C ID\fP option is not given, then it defaults to
\fB\-C 197\fP (since Attribute 197 is generally used to monitor
pending sectors). If the name of this Attribute is changed by a
\*(Aq\-v 197,FORMAT,NAME\*(Aq directive, the default is changed to
\fB\-C 0\fP.
.Sp
If \*(Aq+\*(Aq is specified, a report is only printed if the number of sectors
has increased between two check cycles. Some disks do not reset this
attribute when a bad sector is reallocated.
See also \*(Aq\-v 197,increasing\*(Aq below.
.Sp
The warning email counter is reset if the number of pending sectors
dropped to 0. This typically happens when all pending sectors have
been reallocated or could be read again.
.Sp
A pending sector is a disk sector (containing 512 bytes of your data)
which the device would like to mark as "bad" and reallocate.
Typically this is because your computer tried to read that sector, and
the read failed because the data on it has been corrupted and has
inconsistent Error Checking and Correction (ECC) codes. This is
important to know, because it means that there is some unreadable data
on the disk. The problem of figuring out what file this data belongs
to is operating system and file system specific. You can typically
force the sector to reallocate by writing to it (translation: make the
device substitute a spare good sector for the bad one) but at the
price of losing the 512 bytes of data stored there.
.TP
.B \-U ID[+]
[ATA only] Report if the number of offline uncorrectable sectors is
non-zero. Here \fBID\fP is the id number of the Attribute whose raw
value is the Offline Uncorrectable Sector count. The allowed range of
\fBID\fP is 0 to 255 inclusive. To turn off this reporting, use
ID\ =\ 0. If the \fB\-U ID\fP option is not given, then it defaults to
\fB\-U 198\fP (since Attribute 198 is generally used to monitor
offline uncorrectable sectors). If the name of this Attribute is changed
by a \*(Aq\-v 198,FORMAT,NAME\*(Aq (except
\*(Aq\-v 198,FORMAT,Offline_Scan_UNC_SectCt\*(Aq), directive, the default
is changed to \fB\-U 0\fP.
.Sp
If \*(Aq+\*(Aq is specified, a report is only printed if the number of sectors
has increased since the last check cycle. Some disks do not reset this
attribute when a bad sector is reallocated.
See also \*(Aq\-v 198,increasing\*(Aq below.
.Sp
The warning email counter is reset if the number of offline uncorrectable
sectors dropped to 0. This typically happens when all offline uncorrectable
sectors have been reallocated or could be read again.
.Sp
An offline uncorrectable sector is a disk sector which was not
readable during an off-line scan or a self-test. This is important
to know, because if you have data stored in this disk sector, and you
need to read it, the read will fail. Please see the previous \*(Aq\-C\*(Aq
option for more details.
.TP
.B \-W DIFF[,INFO[,CRIT]]
Report if the current temperature had changed by at least \fBDIFF\fP
degrees since last report, or if new min or max temperature is detected.
Report or Warn if the temperature is greater or equal than one of
\fBINFO\fP or \fBCRIT\fP degrees Celsius.
If the limit \fBCRIT\fP is reached, a message with loglevel
\fB\*(AqLOG_CRIT\*(Aq\fP will be logged to syslog and a warning email
will be send if \*(Aq\-m\*(Aq is specified. If only the limit \fBINFO\fP is
reached, a message with loglevel \fB\*(AqLOG_INFO\*(Aq\fP will be logged.
.Sp
The warning email counter is reset if the temperature dropped below
\fBINFO\fP or \fBCRIT\fP-5 if \fBINFO\fP is not specified.
.Sp
If this directive is used in conjunction with state persistence
(\*(Aq\-s\*(Aq option), the min and max temperature values are preserved
across boot cycles. The minimum temperature value is not updated
during the first 30 minutes after startup.
.Sp
To disable any of the 3 reports, set the corresponding limit to 0.
Trailing zero arguments may be omitted. By default, all temperature
reports are disabled (\*(Aq\-W 0\*(Aq).
.Sp
To track temperature changes of at least 2 degrees, use:
.br
.B \-W 2
.br
To log informal messages on temperatures of at least 40 degrees, use:
.br
.B \-W 0,40
.br
For warning messages/mails on temperatures of at least 45 degrees, use:
.br
.B \-W 0,0,45
.br
To combine all of the above reports, use:
.br
.B \-W 2,40,45
.Sp
For ATA devices, smartd interprets Attribute 194 or 190 as Temperature Celsius
by default. This can be changed to Attribute 9 or 220 by the drive
database or by the \*(Aq\-v 9,temp\*(Aq or \*(Aq\-v 220,temp\*(Aq directive.
.\" %IF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.Sp
For NVMe devices, smartd checks the maximum of the Composite Temperature value
and all Temperature Sensor values reported by SMART/Health Information log.
.\" %ENDIF OS Darwin FreeBSD Linux NetBSD Windows Cygwin
.TP
.B \-F TYPE
[ATA only] Modifies the behavior of \fBsmartd\fP to compensate for some
known and understood device firmware bug. This directive may be used
multiple times. The valid arguments are:
.Sp
.I none
\- Assume that the device firmware obeys the ATA specifications. This
is the default, unless the device has presets for \*(Aq\-F\*(Aq in the
drive database. Using this directive will override any preset values.
.Sp
.I nologdir
\- Suppresses read attempts of SMART or GP Log Directory.
Support for all standard logs is assumed without an actual check.
Some Intel SSDs may freeze if log address 0 is read.
.Sp
.I samsung
\- In some Samsung disks (example: model SV4012H Firmware Version:
RM100-08) some of the two- and four-byte quantities in the SMART data
structures are byte-swapped (relative to the ATA specification).
Enabling this option tells \fBsmartd\fP to evaluate these quantities
in byte-reversed order. Some signs that your disk needs this option
are (1) no self-test log printed, even though you have run self-tests;
(2) very large numbers of ATA errors reported in the ATA error log;
(3) strange and impossible values for the ATA error log timestamps.
.Sp
.I samsung2
\- In some Samsung disks the number of ATA errors reported is byte swapped.
Enabling this option tells \fBsmartd\fP to evaluate this quantity in
byte-reversed order.
.Sp
.I samsung3
\- Some Samsung disks (at least SP2514N with Firmware VF100-37) report
a self-test still in progress with 0% remaining when the test was already
completed. If this directive is specified, \fBsmartd\fP will not skip the
next scheduled self-test (see Directive \*(Aq\-s\*(Aq above) in this case.
.Sp
.I xerrorlba
\- This only affects \fBsmartctl\fP.
.Sp
[Please see the \fBsmartctl \-F\fP command-line option.]
.TP
.B \-v ID,FORMAT[:BYTEORDER][,NAME]
[ATA only] Sets a vendor-specific raw value print FORMAT, an optional
BYTEORDER and an optional NAME for Attribute ID.
This directive may be used multiple times.
Please see \fBsmartctl \-v\fP command-line option for further details.
.Sp
The following arguments affect smartd warning output:
.Sp
.I 197,increasing
\- Raw Attribute number 197 (Current Pending Sector Count) is not
reset if uncorrectable sectors are reallocated. This sets \*(Aq\-C 197+\*(Aq
if no other \*(Aq\-C\*(Aq directive is specified.
.Sp
.I 198,increasing
\- Raw Attribute number 198 (Offline Uncorrectable Sector Count) is not
reset if uncorrectable sectors are reallocated. This sets \*(Aq\-U 198+\*(Aq
if no other \*(Aq\-U\*(Aq directive is specified.
.TP
.B \-P TYPE
[ATA only] Specifies whether \fBsmartd\fP should use any preset options
that are available for this drive.
The valid arguments to this Directive are:
.Sp
.I use
\- use any presets that are available for this drive. This is the default.
.Sp
.I ignore
\- do not use any presets for this drive.
.Sp
.I show
\- show the presets listed for this drive in the database.
.Sp
.I showall
\- show the presets that are available for all drives and then exit.
.Sp
[Please see the
.B smartctl \-P
command-line option.]
.TP
.B \-a
Equivalent to turning on all of the following Directives:
.B \*(Aq\-H\*(Aq
to check the SMART health status,
.B \*(Aq\-f\*(Aq
to report failures of Usage (rather than Prefail) Attributes,
.B \*(Aq\-t\*(Aq
to track changes in both Prefailure and Usage Attributes,
.B \*(Aq\-l\ error\*(Aq
to report increases in the number of ATA errors,
.B \*(Aq\-l\ selftest\*(Aq
to report increases in the number of Self-Test Log errors,
.B \*(Aq\-l\ selfteststs\*(Aq
to report changes of Self-Test execution status,
.B \*(Aq\-C 197\*(Aq
to report nonzero values of the current pending sector count, and
.B \*(Aq\-U 198\*(Aq
to report nonzero values of the offline pending sector count.
.Sp
Note that \-a is the default for ATA devices. If none of these other
Directives is given, then \-a is assumed.
.TP
.B \-c OPTION=VALUE
Allows one to override \fBsmartd\fP command line options for specific devices.
Only the following OPTION is currently supported:
.TP
.B \-c i=N, \-c interval=N
[NEW EXPERIMENTAL SMARTD FEATURE]
Sets the interval between disk checks to N seconds, where N is a decimal
integer.
The minimum allowed value is ten.
The default is the value from the \*(Aq\-i N, \-\-interval=N\*(Aq command
line option or its default of 1800 seconds.
.TP
.B #
Comment: ignore the remainder of the line.
.TP
.B \e
Continuation character: if this is the last non-white or non-comment
character on a line, then the following line is a continuation of the current
one.
.PP
If you are not sure which Directives to use, I suggest experimenting
for a few minutes with
.B smartctl
to see what SMART functionality your disk(s) support(s). If you do
not like voluminous syslog messages, a good choice of
\fBsmartd\fP
configuration file Directives might be:
.br
\fB\-H \-l selftest \-l error \-f\fP.
.br
If you want more frequent information, use: \fB\-a\fP.
.Sp
.TP
.B EXAMPLES OF SHELL SCRIPTS FOR \*(Aq\-M exec\*(Aq
These are two examples of shell scripts that can be used with the \*(Aq\-M
exec PATH\*(Aq Directive described previously. The paths to these scripts
and similar executables is the PATH argument to the \*(Aq\-M exec PATH\*(Aq
Directive.
.Sp
Example 1: This script is for use with \*(Aq\-m ADDRESS \-M exec PATH\*(Aq.
It appends the output of
.B smartctl \-a
to the output of the smartd email warning message and sends it to ADDRESS.
.Sp
.Vb 4
#! /bin/sh
# Save the email message (STDIN) to a file:
cat > /root/msg
# Append the output of smartctl \-a to the message:
/usr/local/sbin/smartctl \-a \-d $SMART_DEVICETYPE \e
$SMARTD_DEVICE >> /root/msg
# Now email the message to the user at address ADD:
/usr/bin/mail \-s "$SMARTD_SUBJECT" $SMARTD_ADDRESS \e
< /root/msg
.Ve
.Sp
Example 2: This script is for use with \*(Aq\-m <nomailer> \-M exec
PATH\*(Aq. It warns all users about a disk problem, waits 30 seconds, and
then powers down the machine.
.Sp
.Vb 4
#! /bin/sh
# Warn all users of a problem
wall <<EOF
Problem detected with disk: $SMARTD_DEVICESTRING
Warning message from smartd is: $SMARTD_MESSAGE
Shutting down machine in 30 seconds...
EOF
# Wait half a minute
sleep 30
# Power down the machine
/sbin/shutdown \-hf now
.Ve
.Sp
Some example scripts are distributed with the smartmontools package,
in /usr/local/share/doc/smartmontools/examplescripts/.
.Sp
Please note that these scripts typically run as root, so any files
that they read/write should not be writable by ordinary users or
reside in directories like /tmp that are writable by ordinary users
and may expose your system to symlink attacks.
.Sp
As previously described, if the scripts write to STDOUT or STDERR,
this is interpreted as indicating that there was an internal error
within the script, and a snippet of STDOUT/STDERR is logged to SYSLOG.
The remainder is flushed.
.Sp
.\" %IF NOT OS Windows
.SH FILES
.TP
.B /usr/local/etc/smartd.conf
full path of this file.
.Sp
.\" %ENDIF NOT OS Windows
.SH SEE ALSO
\fBsmartd\fP(8), \fBsmartctl\fP(8),
\fBmail\fP(1), \fBregex\fP(7).
.Sp
.SH PACKAGE VERSION
CURRENT_SVN_VERSION CURRENT_SVN_DATE CURRENT_SVN_REV
.br
$Id$