mirror of
git://slackware.nl/current.git
synced 2025-01-02 06:19:52 +01:00
45 lines
830 B
Text
45 lines
830 B
Text
|
#!/bin/sh
|
||
|
#
|
||
|
# /etc/rc.d/rc.smartd
|
||
|
#
|
||
|
# 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.
|
||
|
|
||
|
smart_start() {
|
||
|
if [ -x /usr/sbin/smartd -a -r /etc/smartd.conf ]; then
|
||
|
echo "Starting smartd: /usr/sbin/smartd -p /run/smartd.pid &"
|
||
|
/usr/sbin/smartd -p /run/smartd.pid &
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
smart_stop() {
|
||
|
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
|