diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:14:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:14:45 +0000 |
commit | 43e8530e93493bb978c446a2023134bdd4277e50 (patch) | |
tree | e8c0d3c0c394b17381f48fb2d288f166b4f22440 /smartd.freebsd.initd.in | |
parent | Initial commit. (diff) | |
download | smartmontools-43e8530e93493bb978c446a2023134bdd4277e50.tar.xz smartmontools-43e8530e93493bb978c446a2023134bdd4277e50.zip |
Adding upstream version 7.4.upstream/7.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | smartd.freebsd.initd.in | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/smartd.freebsd.initd.in b/smartd.freebsd.initd.in new file mode 100644 index 0000000..cac8432 --- /dev/null +++ b/smartd.freebsd.initd.in @@ -0,0 +1,70 @@ +#!/bin/sh + +# $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.4 2012/02/15 08:46:57 dougb Exp $ +# +# PROVIDE: smartd +# REQUIRE: LOGIN +# KEYWORD: shutdown nojail +# +# Define these smartd_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/smartd +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE + +. /etc/rc.subr + +name=smartd +rcvar=smartd_enable + +load_rc_config smartd + +: ${smartd_enable:="NO"} + +required_files=${smartd_config:="/usr/local/etc/smartd.conf"} +pidfile=${smartd_pidfile:="/var/run/smartd.pid"} + +command="/usr/local/sbin/smartd" +command_args="-c ${required_files} -p ${pidfile}" + +extra_commands="reload report" +reload_cmd="smartd_reload" +report_cmd="smartd_report" + +start_precmd=smartd_prestart + +smartd_prestart() +{ + case "${smartd_flags}" in + -p*|*-p*) + err 1 'smartd_flags includes the -p option, use smartd_pidfile instead' + ;; + esac +} + +smartd_reload() +{ + local status + + if ! status=`run_rc_command status 2>&1`; then + echo $status + return 1 + fi + echo 'Reloading smartd.' + kill -HUP $rc_pid +} + +smartd_report() +{ + local status + + if ! status=`run_rc_command status 2>&1`; then + echo $status + return 1 + fi + echo 'Checking SMART devices now.' + kill -USR1 $rc_pid +} + +run_rc_command "$1" |