]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame_incremental - smartd.freebsd.initd.in
Refresh original patches with new upstream release
[mirror_smartmontools-debian.git] / smartd.freebsd.initd.in
... / ...
CommitLineData
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
18name=smartd
19rcvar=smartd_enable
20
21load_rc_config smartd
22
23: ${smartd_enable:="NO"}
24
25required_files=${smartd_config:="/usr/local/etc/smartd.conf"}
26pidfile=${smartd_pidfile:="/var/run/smartd.pid"}
27
28command="/usr/local/sbin/smartd"
29command_args="-c ${required_files} -p ${pidfile}"
30
31extra_commands="reload report"
32reload_cmd="smartd_reload"
33report_cmd="smartd_report"
34
35start_precmd=smartd_prestart
36
37smartd_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
46smartd_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
58smartd_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
70run_rc_command "$1"