2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2021-03-08 20:19:03 +01:00
|
|
|
# /etc/rc.d/rc.smartd
|
2018-05-28 21:12:29 +02:00
|
|
|
#
|
|
|
|
# Start/stop/restart the smartd daemon, which monitors the status of
|
|
|
|
# S.M.A.R.T. compatible hard drives and reports any problems.
|
|
|
|
#
|
|
|
|
# By default, smartd will scan for all ATA/SATA and SCSI/SAS hard drives
|
|
|
|
# and solid-state drives. Settings may be customized in /etc/smartd.conf.
|
2021-03-08 20:19:03 +01:00
|
|
|
|
|
|
|
# Import script defaults:
|
|
|
|
if [ -r /etc/default/smartd ]; then
|
|
|
|
. /etc/default/smartd
|
|
|
|
fi
|
2018-05-28 21:12:29 +02:00
|
|
|
|
|
|
|
smart_start() {
|
|
|
|
if [ -x /usr/sbin/smartd -a -r /etc/smartd.conf ]; then
|
2021-03-08 20:19:03 +01:00
|
|
|
echo "Starting smartd: /usr/sbin/smartd -p /run/smartd.pid $SMARTD_OPTIONS &"
|
|
|
|
/usr/sbin/smartd -p /run/smartd.pid $SMARTD_OPTIONS &
|
2018-05-28 21:12:29 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
smart_stop() {
|
2021-03-08 20:19:03 +01:00
|
|
|
echo "Stopping smartd."
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -r /run/smartd.pid ]; then
|
|
|
|
kill $(cat /run/smartd.pid)
|
|
|
|
else
|
|
|
|
killall smartd
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
smart_restart() {
|
|
|
|
smart_stop
|
|
|
|
sleep 1
|
|
|
|
smart_start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
smart_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
smart_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
smart_restart
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
|
|
esac
|