File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / smartmontools / smartd.freebsd.initd.in
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 16:32:16 2012 UTC (12 years, 4 months ago) by misho
Branches: smartmontools, elwix, MAIN
CVS tags: v5_42, HEAD
smartmontools

    1: #!/bin/sh
    2: # $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.2 2010/03/27 00:15:05 dougb Exp $
    3: 
    4: # PROVIDE: smartd
    5: # REQUIRE: DAEMON
    6: # BEFORE: 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: smartd_enable="${smartd_enable-NO}"
   17: smartd_pidfile="/var/run/smartd.pid"
   18: 
   19: . /etc/rc.subr
   20: 
   21: name="smartd"
   22: rcvar=`set_rcvar`
   23: command="/usr/local/sbin/smartd"
   24: extra_commands="reload report"
   25: reload_cmd="smartd_reload"
   26: report_cmd="smartd_report"
   27: 
   28: smartd_reload()
   29: {
   30:     rc_pid=$(check_pidfile $pidfile $command)
   31:     if [ -z "$rc_pid" ]; then
   32:         [ -n "$rc_fast" ] && return 0
   33:         _run_rc_notrunning
   34:         return 1
   35:     fi
   36:     echo 'Reloading smartd.'
   37:     kill -HUP $rc_pid
   38: }
   39: 
   40: smartd_report()
   41: {
   42:     rc_pid=$(check_pidfile $pidfile $command)
   43:     if [ -z "$rc_pid" ]; then
   44:         [ -n "$rc_fast" ] && return 0
   45:         _run_rc_notrunning
   46:         return 1
   47:     fi
   48:     echo 'Checking SMART devices now.'
   49:     kill -USR1 $rc_pid
   50: }
   51: 
   52: load_rc_config $name
   53: 
   54: : ${smartd_config="/usr/local/etc/smartd.conf"}
   55: : ${smartd_flags="-c ${smartd_config}"}
   56: 
   57: pidfile="${smartd_pidfile}"
   58: required_files="${smartd_config}"
   59: 
   60: case "${smartd_flags}" in
   61: *-p\ *)
   62:         echo "ERROR: \$smartd_flags includes -p option." \
   63:                 "Please use \$smartd_pidfile instead."
   64:         exit 1
   65:         ;;
   66: *)
   67:         smartd_flags="-p ${pidfile} ${smartd_flags}"
   68:         ;;
   69: esac
   70: 
   71: run_rc_command "$1"

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