File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / smartmontools / os_darwin / SMART.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, 6 months ago) by misho
Branches: smartmontools, elwix, MAIN
CVS tags: v5_43, v5_42, HEAD
smartmontools

#!/bin/sh

# Darwin init file for smartd
#
# Home page of code is: http://smartmontools.sourceforge.net
#
# Copyright (C) 2004-8 Geoffrey Keating <geoffk@geoffk.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# You should have received a copy of the GNU General Public License (for
# example COPYING); if not, write to the Free Software Foundation, Inc., 675
# Mass Ave, Cambridge, MA 02139, USA.

# $Id: SMART.in,v 1.1.1.1 2012/02/21 16:32:16 misho Exp $

##
# SMART monitoring
##

. /etc/rc.common

StartService ()
{
    if [ "${SMARTd:=-YES-}" = "-YES-" ] &&
       ! GetPID smartd > /dev/null; then

        ConsoleMessage "Starting SMART disk monitoring"

        /usr/sbin/smartd -p /var/run/smartd.pid
    fi
}

StopService ()
{
    if pid=$(GetPID smartd); then
        ConsoleMessage "Stopping SMART disk monitoring"
        kill -TERM "${pid}"
    else
        echo "smartd is not running."
    fi
}

RestartService ()
{
    if pid=$(GetPID smartd); then
        kill -HUP "${pid}"
    else
        StartService
    fi
}

RunService "$1"

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