1: #!/bin/sh
2:
3: # $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.4 2012/02/15 08:46:57 dougb Exp $
4: #
5: # PROVIDE: smartd
6: # REQUIRE: LOGIN
7: # KEYWORD: shutdown nojail
8: #
9: # Define these smartd_* variables in one of these files:
10: # /etc/rc.conf
11: # /etc/rc.conf.local
12: # /etc/rc.conf.d/smartd
13: #
14: # DO NOT CHANGE THESE DEFAULT VALUES HERE
15:
16: . /etc/rc.subr
17:
18: name=smartd
19: rcvar=smartd_enable
20:
21: load_rc_config smartd
22:
23: : ${smartd_enable:="NO"}
24:
25: required_files=${smartd_config:="/usr/local/etc/smartd.conf"}
26: pidfile=${smartd_pidfile:="/var/run/smartd.pid"}
27:
28: command="/usr/local/sbin/smartd"
29: command_args="-c ${required_files} -p ${pidfile}"
30:
31: extra_commands="reload report"
32: reload_cmd="smartd_reload"
33: report_cmd="smartd_report"
34:
35: start_precmd=smartd_prestart
36:
37: smartd_prestart()
38: {
39: case "${smartd_flags}" in
40: -p*|*-p*)
41: err 1 'smartd_flags includes the -p option, use smartd_pidfile instead'
42: ;;
43: esac
44: }
45:
46: smartd_reload()
47: {
48: local status
49:
50: if ! status=`run_rc_command status 2>&1`; then
51: echo $status
52: return 1
53: fi
54: echo 'Reloading smartd.'
55: kill -HUP $rc_pid
56: }
57:
58: smartd_report()
59: {
60: local status
61:
62: if ! status=`run_rc_command status 2>&1`; then
63: echo $status
64: return 1
65: fi
66: echo 'Checking SMART devices now.'
67: kill -USR1 $rc_pid
68: }
69:
70: run_rc_command "$1"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>