]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - os_darwin/SMART.in
Imported Upstream version 6.1+svn3812
[mirror_smartmontools-debian.git] / os_darwin / SMART.in
1 #!/bin/sh
2
3 # Darwin init file for smartd
4 #
5 # Home page of code is: http://smartmontools.sourceforge.net
6 #
7 # Copyright (C) 2004-8 Geoffrey Keating <geoffk@geoffk.org>
8 #
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the Free
11 # Software Foundation; either version 2, or (at your option) any later
12 # version.
13 #
14 # You should have received a copy of the GNU General Public License (for
15 # example COPYING); if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 # $Id: SMART.in 3728 2012-12-13 17:57:50Z chrfranke $
19
20 ##
21 # SMART monitoring
22 ##
23
24 . /etc/rc.common
25
26 StartService ()
27 {
28 if [ "${SMARTd:=-YES-}" = "-YES-" ] &&
29 ! GetPID smartd > /dev/null; then
30
31 ConsoleMessage "Starting SMART disk monitoring"
32
33 /usr/sbin/smartd -p /var/run/smartd.pid
34 fi
35 }
36
37 StopService ()
38 {
39 if pid=$(GetPID smartd); then
40 ConsoleMessage "Stopping SMART disk monitoring"
41 kill -TERM "${pid}"
42 else
43 echo "smartd is not running."
44 fi
45 }
46
47 RestartService ()
48 {
49 if pid=$(GetPID smartd); then
50 kill -HUP "${pid}"
51 else
52 StartService
53 fi
54 }
55
56 RunService "$1"