Annotation of embedaddon/smartmontools/smartd.freebsd.initd.in, revision 1.1.1.2

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>