Skip to content
Snippets Groups Projects
Commit afa0dd34 authored by ballen4705's avatar ballen4705
Browse files

Sending SIGUSR1 to smartd now makes it check the status of the disk

immediately, after which it returns to polling the disks every N seconds.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@298 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 84f60008
No related branches found
No related tags found
No related merge requests found
CHANGELOG for smartmontools
$Id: CHANGELOG,v 1.52 2002/11/21 16:49:43 knan Exp $
$Id: CHANGELOG,v 1.53 2002/11/21 17:45:59 ballen4705 Exp $
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
......@@ -25,6 +25,12 @@ NOTES FOR FUTURE RELEASES: see TODO file.
CURRENT RELEASE (see VERSION file in this directory):
Allen: smartd: user can make smartd check the disks at any time
(ie, interrupt sleep) by sending signal SIGUSR1 to smartd. This
can be done for example with:
kill -USR1 <pid>
where <pid> is the process ID number of smartd.
Bolsø: scsi: don't trust the data we receive from the drive too
much. It very well might have errors (like zero response length).
Seen on Megaraid logical drive, and verified in the driver source.
......
......@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
$Id: TODO,v 1.23 2002/11/13 23:00:57 pervalidus Exp $
$Id: TODO,v 1.24 2002/11/21 17:45:59 ballen4705 Exp $
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
......@@ -63,8 +63,8 @@ Add following config file directives:
Use daemon (8) function instead of do-it-yourself daemon_init(). But,
does it close all open file descriptors? Must read glibc code to see:
documentation unclear.
documentation unclear. [Some discussion indicates that this is
not a good idea. Daemon (8) is not in all standard libraries.]
General Fixes
-------------
......
\# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
\#
\# $Id: smartd.8,v 1.31 2002/11/21 14:11:19 ballen4705 Exp $
\# $Id: smartd.8,v 1.32 2002/11/21 17:45:59 ballen4705 Exp $
\#
\# 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
......@@ -16,7 +16,7 @@
\# Research Center), Jack Baskin School of Engineering, University of
\# California, Santa Cruz. http://ssrc.soe.ucsc.edu/
\#
.TH SMARTD 8 "$Date: 2002/11/21 14:11:19 $" "smartmontools-5.0"
.TH SMARTD 8 "$Date: 2002/11/21 17:45:59 $" "smartmontools-5.0"
.SH NAME
smartd \- S.M.A.R.T. Daemon
.SH SYNOPSIS
......@@ -37,10 +37,12 @@ below)
.B smartd
will attempt to enable S.M.A.R.T. monitoring on ATA devices, and polls
these and SCSI devices every 30 minutes, logging S.M.A.R.T. errors and
these and SCSI devices every 30 minutes (configurable), logging S.M.A.R.T. errors and
changes of S.M.A.R.T. Attributes via the SYSLOG interface. These
notifications and warnings normally appear in
.B /var/log/messages. smartd
.B /var/log/messages.
.B smartd
can be configured at start-up using the file
.B /etc/smartd.conf.
Note that
......@@ -48,13 +50,25 @@ Note that
only reads the configuration file at start-up: changes to the
configuration file take effect only after the
.B smartd
daemon is restarted. If you send a HUP signal to
daemon is restarted.
If you send a
.B HUP
signal to
.B smartd
it will log a polite message saying that it ignores this signal and
that it has
.I not
re-read the configuration file.
If you send a
.B USR1
signal to
.B smartd
it will immediately check the status of the disks, and then return to
polling the disks every 30 minutes. See the
.B '\-C'
Directive below for additional details.
On startup, in the absence of the configuration file
.B /etc/smartd.conf,
the
......@@ -290,7 +304,23 @@ final value that is given is used. That final value applies to all the disks.
The default value of
.B <N>
is 1800 sec, and the minimum allowed value is
ten seconds.
ten seconds. The maximum value is 2^31-1 seconds.
Note that the superuser can make
.B smartd
check the status of the disks at any time by sending it the
.B SIGHUP
signal, for example with the command:
.nf
.B kill -SIGUSR1 <pid>
.fi
where
.B <pid>
is the process id number of smartd. One may also use:
.nf
.B killall -USR1 smartd
.fi
for the same purpose.
.TP
.B \-P
Permissive: Even if the disk appears to lack SMART capabilities, try
......@@ -593,4 +623,4 @@ Please let us know if there is an on\-line source for this document.
.SH
CVS ID OF THIS PAGE:
$Id: smartd.8,v 1.31 2002/11/21 14:11:19 ballen4705 Exp $
$Id: smartd.8,v 1.32 2002/11/21 17:45:59 ballen4705 Exp $
......@@ -46,7 +46,7 @@
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.c,v 1.68 2002/11/21 14:50:20 ballen4705 Exp $"
const char *CVSid6="$Id: smartd.c,v 1.69 2002/11/21 17:45:59 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc.
......@@ -59,6 +59,15 @@ int numscsidevices=0;
// How long to sleep between checks. Handy as global variable for
// debugging
int checktime=CHECKTIME;
volatile int sleeptime=CHECKTIME;
// Interrupt sleep if we get a SIGUSR1
void sleephandler(int sig){
int oldsleeptime=sleeptime;
sleeptime=0;
printout(LOG_CRIT,"Signal USR1 - checking devices now rather than in %d seconds.\n",oldsleeptime<0?0:oldsleeptime);
return;
}
// Global Variables for command line options. These should go into a
// structure at some point.
......@@ -842,7 +851,12 @@ void CheckDevices(atadevices_t *atadevices, scsidevices_t *scsidevices){
for (i=0; i<numscsidevices; i++)
scsiCheckDevice(scsidevices+i);
sleep(checktime);
// Sleep until next check. Note that since sleeptime can be set to
// zero by an EXTERNAL signal SIGUSR1, it's possible for sleeptime
// to be negative. Don't use while (sleeptime)!
sleeptime=checktime;
while (sleeptime-->0)
sleep(1);
}
}
......@@ -1361,6 +1375,8 @@ int main (int argc, char **argv){
signal(SIGQUIT, SIG_IGN);
if (signal(SIGHUP, huphandler)==SIG_IGN)
signal(SIGHUP, SIG_IGN);
if (signal(SIGUSR1, sleephandler)==SIG_IGN)
signal(SIGUSR1, SIG_IGN);
// install goobye message
......
\# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
\#
\# $Id: smartd.conf.5,v 1.7 2002/11/21 14:15:17 ballen4705 Exp $
\# $Id: smartd.conf.5,v 1.8 2002/11/21 17:46:00 ballen4705 Exp $
\#
\# 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
......@@ -16,7 +16,7 @@
\# Research Center), Jack Baskin School of Engineering, University of
\# California, Santa Cruz. http://ssrc.soe.ucsc.edu/
\#
.TH SMARTD.CONF 5 "$Date: 2002/11/21 14:15:17 $" "smartmontools-5.0"
.TH SMARTD.CONF 5 "$Date: 2002/11/21 17:46:00 $" "smartmontools-5.0"
.SH NAME
smartd.conf \- S.M.A.R.T. Monitoring Daemon Configuration File
......@@ -188,7 +188,23 @@ final value that is given is used. That final value applies to all the disks.
The default value of
.B <N>
is 1800 sec, and the minimum allowed value is
ten seconds.
ten seconds. The maximum value is 2^31-1 seconds.
Note that the superuser can make
.B smartd
check the status of the disks at any time by sending it the
.B SIGHUP
signal, for example with the command:
.nf
.B kill -SIGUSR1 <pid>
.fi
where
.B <pid>
is the process id number of smartd. One may also use:
.nf
.B killall -USR1 smartd
.fi
for the same purpose.
.TP
.B \-P
Permissive: Even if the disk appears to lack SMART capabilities, try
......@@ -421,4 +437,4 @@ SEE ALSO:
.SH
CVS ID OF THIS PAGE:
$Id: smartd.conf.5,v 1.7 2002/11/21 14:15:17 ballen4705 Exp $
$Id: smartd.conf.5,v 1.8 2002/11/21 17:46:00 ballen4705 Exp $
......@@ -46,7 +46,7 @@
// CVS ID strings
extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.cpp,v 1.68 2002/11/21 14:50:20 ballen4705 Exp $"
const char *CVSid6="$Id: smartd.cpp,v 1.69 2002/11/21 17:45:59 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc.
......@@ -59,6 +59,15 @@ int numscsidevices=0;
// How long to sleep between checks. Handy as global variable for
// debugging
int checktime=CHECKTIME;
volatile int sleeptime=CHECKTIME;
// Interrupt sleep if we get a SIGUSR1
void sleephandler(int sig){
int oldsleeptime=sleeptime;
sleeptime=0;
printout(LOG_CRIT,"Signal USR1 - checking devices now rather than in %d seconds.\n",oldsleeptime<0?0:oldsleeptime);
return;
}
// Global Variables for command line options. These should go into a
// structure at some point.
......@@ -842,7 +851,12 @@ void CheckDevices(atadevices_t *atadevices, scsidevices_t *scsidevices){
for (i=0; i<numscsidevices; i++)
scsiCheckDevice(scsidevices+i);
sleep(checktime);
// Sleep until next check. Note that since sleeptime can be set to
// zero by an EXTERNAL signal SIGUSR1, it's possible for sleeptime
// to be negative. Don't use while (sleeptime)!
sleeptime=checktime;
while (sleeptime-->0)
sleep(1);
}
}
......@@ -1361,6 +1375,8 @@ int main (int argc, char **argv){
signal(SIGQUIT, SIG_IGN);
if (signal(SIGHUP, huphandler)==SIG_IGN)
signal(SIGHUP, SIG_IGN);
if (signal(SIGUSR1, sleephandler)==SIG_IGN)
signal(SIGUSR1, SIG_IGN);
// install goobye message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment