- fix #271741 - smartd-conf.py should allow customization of parameters

- fix #253753 - service starting by default, perhaps shouldn't
- update initscript (related #247058 - initscript review)
This commit is contained in:
Tomas Smetana 2007-09-04 11:59:22 +00:00
parent 7d9c446d5c
commit b021c51f2e
4 changed files with 140 additions and 76 deletions

View File

@ -73,6 +73,11 @@ def getfile(fname):
line = ''
return line
try:
execfile('/etc/sysconfig/smartmontools')
except IOError:
pass
for drive in drives:
if getfile("%s/removable" % drive.sysfspath) == '0':
driver = ''
@ -86,6 +91,9 @@ for drive in drives:
(driver, drive.device))
if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0:
comment = "# smartctl -i returns error for this drive\n# "
try:
print "%s%s %s %s" % (comment, drive.device, driver, smartd_conf_opts)
except NameError:
print "%s%s %s -H -m root" % (comment, drive.device, driver)
print """

View File

@ -2,13 +2,23 @@
# smartmontools init file for smartd
# Copyright (C) 2002-4 Bruce Allen <smartmontools-support@lists.sourceforge.net>
# $Id: smartd.initd,v 1.5 2007/06/21 13:26:38 tsmetana Exp $
# $Id: smartd.initd,v 1.6 2007/09/04 11:59:22 tsmetana Exp $
# For RedHat and cousins:
# chkconfig: 2345 99 01
# chkconfig: - 99 01
# description: Self Monitoring and Reporting Technology (SMART) Daemon
# processname: smartd
### BEGIN INIT INFO
# Provides: smartd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Short-Description: Self Monitoring and Reporting Technology (SMART) Daemon
# Description: The smartd daemon monitors SMART status of the local hard drives and
# provides advanced warnings of of disk degradation or failures.
### END INIT INFO
# 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
@ -33,8 +43,12 @@ SMARTD_BIN=/usr/sbin/smartd
[ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
case "$1" in
start | reload | restart)
RETVAL=0
prog=smartd
pidfile=/var/lock/subsys/smartd
genconfig()
{
if [ -x /usr/sbin/smartd-conf.py ]; then
GEN_CONF="*SMARTD*AUTOGENERATED*"
[ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY </etc/smartd.conf \
@ -42,49 +56,84 @@ case "$1" in
&& smartd-conf.py 2>/dev/null >/etc/smartd.conf.new-autogenerated \
&& mv -f /etc/smartd.conf.new-autogenerated /etc/smartd.conf
fi
;;
esac
}
RETVAL=0
prog=smartd
case "$1" in
start)
start()
{
echo -n $"Starting $prog: "
daemon $SMARTD_BIN $smartd_opts
touch /var/lock/subsys/smartd
RETVAL=$?
echo
exit 0
;;
stop)
[ $RETVAL = 0 ] && touch $pidfile
return $RETVAL
}
stop()
{
echo -n $"Shutting down $prog: "
killproc $SMARTD_BIN
rm -f /var/lock/subsys/smartd
RETVAL=$?
echo
;;
reload)
rm -f $pidfile
return $RETVAL
}
reload()
{
echo -n $"Reloading $prog daemon configuration: "
killproc $SMARTD_BIN -HUP
RETVAL=$?
echo
;;
report)
return $RETVAL
}
report()
{
echo -n $"Checking SMART devices now: "
killproc $SMARTD_BIN -USR1
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
genconfig
start
;;
stop)
stop
;;
reload)
genconfig
reload
;;
report)
report
;;
restart)
$0 stop
$0 start
stop
genconfig
start
;;
try-restart)
if [ -f $pidfile ]; then
stop
genconfig
start
fi
;;
force-reload)
genconfig
reload || (stop; start)
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|reload|report|restart|status}"
RETVAL=1
echo $"Usage: $0 {start|stop|reload|force-reload|report|restart|try-restart|status}"
RETVAL=3
esac
exit $RETVAL

View File

@ -1,7 +1,7 @@
Summary: Tools for monitoring SMART capable hard disks
Name: smartmontools
Version: 5.37
Release: 5%{?dist}
Release: 6%{?dist}
Epoch: 1
Group: System Environment/Base
License: GPLv2+
@ -91,6 +91,11 @@ exit 0
%exclude %{_sbindir}/smartd-conf.py[co]
%changelog
* Tue Sep 04 2007 Tomas Smetana <tsmetana@redhat.com> - 1:5.37-6
- fix #271741 - smartd-conf.py should allow customization of parameters
- fix #253753 - service starting by default, perhaps shouldn't
- update initscript (related #247058 - initscript review)
* Mon Aug 20 2007 Tomas Smetana <tsmetana@redhat.com> - 1:5.37-5
- add support for 24 disks on 3ware RAID controllers (related #252055)
- fix #245442 - add %%{arm} to smartmontools's set of build archs

View File

@ -1,2 +1,4 @@
# command line options for smartd
smartd_opts="-q never"
# autogenerated config file options
# smartd_conf_opts="-H -m root"