]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - smartd.freebsd.initd.in
Stop passing arguments to dh_installinit
[mirror_smartmontools-debian.git] / smartd.freebsd.initd.in
CommitLineData
a7e8ffec 1#!/bin/sh
a7e8ffec 2
d008864d
GI
3# $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.4 2012/02/15 08:46:57 dougb Exp $
4#
a7e8ffec 5# PROVIDE: smartd
d008864d 6# REQUIRE: LOGIN
a7e8ffec 7# KEYWORD: shutdown nojail
d008864d 8#
a7e8ffec 9# Define these smartd_* variables in one of these files:
d008864d
GI
10# /etc/rc.conf
11# /etc/rc.conf.local
12# /etc/rc.conf.d/smartd
a7e8ffec
GI
13#
14# DO NOT CHANGE THESE DEFAULT VALUES HERE
a7e8ffec
GI
15
16. /etc/rc.subr
17
d008864d
GI
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
a7e8ffec 28command="/usr/local/sbin/smartd"
d008864d
GI
29command_args="-c ${required_files} -p ${pidfile}"
30
a7e8ffec
GI
31extra_commands="reload report"
32reload_cmd="smartd_reload"
33report_cmd="smartd_report"
34
d008864d 35start_precmd=smartd_prestart
a7e8ffec 36
d008864d 37smartd_prestart()
a7e8ffec 38{
d008864d
GI
39 case "${smartd_flags}" in
40 -p*|*-p*)
41 err 1 'smartd_flags includes the -p option, use smartd_pidfile instead'
42 ;;
43 esac
a7e8ffec
GI
44}
45
d008864d
GI
46smartd_reload()
47{
48 local status
a7e8ffec 49
d008864d
GI
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}
a7e8ffec 57
d008864d
GI
58smartd_report()
59{
60 local status
a7e8ffec 61
d008864d
GI
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}
a7e8ffec
GI
69
70run_rc_command "$1"