summaryrefslogtreecommitdiffstats
path: root/main/smartmontools/smartd.initd
blob: 131a7d45f98b59cca91fb5b49c738b9c7555aff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/smartmontools/files/smartd.rc,v 1.9 2011/09/15 07:58:50 polynomial-c Exp $

depend() {
    need localmount
    after bootmisc
}

extra_started_commands="reload"

checkconfig() {
	if [ ! -f "/etc/smartd.conf" ] ; then
		eerror "You should setup your /etc/smartd.conf file!"
		eerror "See the smartd.conf(5) manpage."
		return 1
	fi
	return 0
}

start() {
	checkconfig || return 1

	ebegin "Starting S.M.A.R.T. monitoring daemon"
	start-stop-daemon --start --exec /usr/sbin/smartd \
	    --pidfile /var/run/smartd.pid \
	    -- -p /var/run/smartd.pid ${SMARTD_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping S.M.A.R.T. monitoring daemon"
	start-stop-daemon --stop --exec /usr/sbin/smartd \
	    --pidfile /var/run/smartd.pid
	eend $?
}

reload() {
	ebegin "Reloading configuration"
	start-stop-daemon --signal HUP --pidfile /var/run/smartd.pid smartd
	eend $?
}