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

Makes smartd print out a warning message when it gets SIGHUP, saying that it

doesn't re-read its config file and restart.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@154 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 3bc94310
Branches
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net ...@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
$Id: TODO,v 1.16 2002/10/26 09:24:26 ballen4705 Exp $ $Id: TODO,v 1.17 2002/10/29 13:38:49 ballen4705 Exp $
This program is free software; you can redistribute it and/or modify it 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 under the terms of the GNU General Public License as published by the Free
...@@ -34,27 +34,12 @@ Produce version for ATA/ATAPI-7 ...@@ -34,27 +34,12 @@ Produce version for ATA/ATAPI-7
Modifications Modifications
------------- -------------
smartctl:
Handle extended error and self-test logs gracefully. Can someone tell Handle extended error and self-test logs gracefully. Can someone tell
me a disk that supports more than log pages 1 and 6? I need to get a me a disk that supports more than log pages 1 and 6? I need to get a
disk so I can test this functionality, when I add it. disk so I can test this functionality, when I add it.
Change smartd so that it also monitors usage as well as prefail
attributes for failure or changes. Make this a command line option
Perhaps change smartd to look in /proc/ide and /proc/scsi to see what
exists? If something doesn't exit then don't try to open it?
Currently smartd looks at attribute values and thresholds, then prints
out if there is an error condition. Make it also look at the smart
status, if that is enabled and working and do that test as well.
Perhaps also see if the number of device errors has changed.
Add optional flags to /etc/smartd.conf, so that certain attributes are
ignored, or so that all usage attributes are ignored.
Change smartd so that it monitors the ATA disk error log, and if the
number of errors changes, log an entry..
Perhaps modify the -q option (quiet mode) so that it only warns of ATA Perhaps modify the -q option (quiet mode) so that it only warns of ATA
errors if they have (say) taken place in the last 168 hours (week). errors if they have (say) taken place in the last 168 hours (week).
...@@ -65,10 +50,19 @@ helpful in adding device specific options. ...@@ -65,10 +50,19 @@ helpful in adding device specific options.
Parse and print more attribute flag meanings (IBM ones, eg performance Parse and print more attribute flag meanings (IBM ones, eg performance
etc). etc).
Fixes smartd:
-----
Perhaps change smartd to look in /proc/ide and /proc/scsi to see what
exists? If something doesn't exit then don't try to open it? This
should probably be the default option if there is no configuration
file.
General Fixes
-------------
Fix lots of syntax like if (a != 0) Fix lots of syntax like if (a != 0)
Pass pointer to big structures like "device" and smartval, not the Pass pointer to big structures like "device" and smartval, not the
whole 2kB of data! whole 2kB of data! I've started doing this but haven't finished yet.
18 19
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
// CVS ID strings // CVS ID strings
extern const char *CVSid1, *CVSid2; extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.c,v 1.39 2002/10/29 10:06:20 ballen4705 Exp $" const char *CVSid6="$Id: smartd.c,v 1.40 2002/10/29 13:38:49 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc. // global variable used for control of printing, passing arguments, etc.
...@@ -76,12 +76,12 @@ void pout(char *fmt, ...){ ...@@ -76,12 +76,12 @@ void pout(char *fmt, ...){
return; return;
} }
void goobye(){ // tell user that we ignore HUP signals
printout(LOG_CRIT,"smartd is exiting\n"); void huphandler(int sig){
printout(LOG_CRIT,"HUP ignored. smartd does NOT re-read /etc/smartd.conf.\n");
return; return;
} }
volatile sig_atomic_t fatal = 0;
// simple signal handler to print goodby message to syslog // simple signal handler to print goodby message to syslog
void sighandler(int sig){ void sighandler(int sig){
printout(LOG_CRIT,"smartd received signal %d: %s\n", printout(LOG_CRIT,"smartd received signal %d: %s\n",
...@@ -89,6 +89,10 @@ void sighandler(int sig){ ...@@ -89,6 +89,10 @@ void sighandler(int sig){
exit(1); exit(1);
} }
void goobye(){
printout(LOG_CRIT,"smartd is exiting\n");
return;
}
// Forks new process, closes all file descriptors, redirects stdin, // Forks new process, closes all file descriptors, redirects stdin,
// stdout, stderr // stdout, stderr
...@@ -249,6 +253,7 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){ ...@@ -249,6 +253,7 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){
printout(LOG_INFO,"Device: %s, opened\n", device); printout(LOG_INFO,"Device: %s, opened\n", device);
// Get drive identity structure // Get drive identity structure
// May want to add options to enable autosave, automatic online testing
if (ataReadHDIdentity (fd,&drive) || !ataSmartSupport(drive) || ataEnableSmart(fd)){ if (ataReadHDIdentity (fd,&drive) || !ataSmartSupport(drive) || ataEnableSmart(fd)){
// device exists, but not able to do SMART // device exists, but not able to do SMART
printout(LOG_INFO,"Device: %s, not SMART capable, or couldn't enable SMART\n",device); printout(LOG_INFO,"Device: %s, not SMART capable, or couldn't enable SMART\n",device);
...@@ -277,6 +282,10 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){ ...@@ -277,6 +282,10 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){
printout(LOG_INFO,"Device: %s, Read SMART Values and/or Thresholds Failed\n",device); printout(LOG_INFO,"Device: %s, Read SMART Values and/or Thresholds Failed\n",device);
free(devices->smartval); free(devices->smartval);
free(devices->smartthres); free(devices->smartthres);
// make it easy to recognize that we've deallocated
devices->smartval=NULL;
devices->smartthres=NULL;
cfg->usagefailed=cfg->prefail=cfg->usage=0; cfg->usagefailed=cfg->prefail=cfg->usage=0;
} }
} }
...@@ -820,8 +829,9 @@ int parseconfigline(int entry, int lineno,char *line){ ...@@ -820,8 +829,9 @@ int parseconfigline(int entry, int lineno,char *line){
#endif #endif
} }
// basic sanity check -- are any options turned on? // basic sanity check -- are any directives enabled?
if (!(cfg->smartcheck || cfg->usagefailed || cfg->prefail || cfg->usage || cfg->selftest || cfg->errorlog || cfg->tryscsi)){ if (!(cfg->smartcheck || cfg->usagefailed || cfg->prefail || cfg->usage ||
cfg->selftest || cfg->errorlog || cfg->tryscsi)){
printout(LOG_CRIT,"Drive: %s, no monitoring Directives on line %d of file %s\n", printout(LOG_CRIT,"Drive: %s, no monitoring Directives on line %d of file %s\n",
cfg->name, cfg->lineno, CONFIGFILE); cfg->name, cfg->lineno, CONFIGFILE);
Directives(); Directives();
...@@ -1077,6 +1087,7 @@ int main (int argc, char **argv){ ...@@ -1077,6 +1087,7 @@ int main (int argc, char **argv){
con->quietmode=0; con->quietmode=0;
con->veryquietmode=debugmode?0:1; con->veryquietmode=debugmode?0:1;
// look in configuration file CONFIGFILE (normally /etc/smartd.conf) // look in configuration file CONFIGFILE (normally /etc/smartd.conf)
entries=parseconfigfile(); entries=parseconfigfile();
...@@ -1092,6 +1103,9 @@ int main (int argc, char **argv){ ...@@ -1092,6 +1103,9 @@ int main (int argc, char **argv){
signal(SIGTERM, SIG_IGN); signal(SIGTERM, SIG_IGN);
if (signal(SIGQUIT, sighandler)==SIG_IGN) if (signal(SIGQUIT, sighandler)==SIG_IGN)
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
if (signal(SIGHUP, huphandler)==SIG_IGN)
signal(SIGHUP, SIG_IGN);
// install goobye message // install goobye message
atexit(goobye); atexit(goobye);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
// CVS ID strings // CVS ID strings
extern const char *CVSid1, *CVSid2; extern const char *CVSid1, *CVSid2;
const char *CVSid6="$Id: smartd.cpp,v 1.39 2002/10/29 10:06:20 ballen4705 Exp $" const char *CVSid6="$Id: smartd.cpp,v 1.40 2002/10/29 13:38:49 ballen4705 Exp $"
CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; CVSID1 CVSID2 CVSID3 CVSID4 CVSID7;
// global variable used for control of printing, passing arguments, etc. // global variable used for control of printing, passing arguments, etc.
...@@ -76,12 +76,12 @@ void pout(char *fmt, ...){ ...@@ -76,12 +76,12 @@ void pout(char *fmt, ...){
return; return;
} }
void goobye(){ // tell user that we ignore HUP signals
printout(LOG_CRIT,"smartd is exiting\n"); void huphandler(int sig){
printout(LOG_CRIT,"HUP ignored. smartd does NOT re-read /etc/smartd.conf.\n");
return; return;
} }
volatile sig_atomic_t fatal = 0;
// simple signal handler to print goodby message to syslog // simple signal handler to print goodby message to syslog
void sighandler(int sig){ void sighandler(int sig){
printout(LOG_CRIT,"smartd received signal %d: %s\n", printout(LOG_CRIT,"smartd received signal %d: %s\n",
...@@ -89,6 +89,10 @@ void sighandler(int sig){ ...@@ -89,6 +89,10 @@ void sighandler(int sig){
exit(1); exit(1);
} }
void goobye(){
printout(LOG_CRIT,"smartd is exiting\n");
return;
}
// Forks new process, closes all file descriptors, redirects stdin, // Forks new process, closes all file descriptors, redirects stdin,
// stdout, stderr // stdout, stderr
...@@ -249,6 +253,7 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){ ...@@ -249,6 +253,7 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){
printout(LOG_INFO,"Device: %s, opened\n", device); printout(LOG_INFO,"Device: %s, opened\n", device);
// Get drive identity structure // Get drive identity structure
// May want to add options to enable autosave, automatic online testing
if (ataReadHDIdentity (fd,&drive) || !ataSmartSupport(drive) || ataEnableSmart(fd)){ if (ataReadHDIdentity (fd,&drive) || !ataSmartSupport(drive) || ataEnableSmart(fd)){
// device exists, but not able to do SMART // device exists, but not able to do SMART
printout(LOG_INFO,"Device: %s, not SMART capable, or couldn't enable SMART\n",device); printout(LOG_INFO,"Device: %s, not SMART capable, or couldn't enable SMART\n",device);
...@@ -277,6 +282,10 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){ ...@@ -277,6 +282,10 @@ int atadevicescan2(atadevices_t *devices, cfgfile *cfg){
printout(LOG_INFO,"Device: %s, Read SMART Values and/or Thresholds Failed\n",device); printout(LOG_INFO,"Device: %s, Read SMART Values and/or Thresholds Failed\n",device);
free(devices->smartval); free(devices->smartval);
free(devices->smartthres); free(devices->smartthres);
// make it easy to recognize that we've deallocated
devices->smartval=NULL;
devices->smartthres=NULL;
cfg->usagefailed=cfg->prefail=cfg->usage=0; cfg->usagefailed=cfg->prefail=cfg->usage=0;
} }
} }
...@@ -820,8 +829,9 @@ int parseconfigline(int entry, int lineno,char *line){ ...@@ -820,8 +829,9 @@ int parseconfigline(int entry, int lineno,char *line){
#endif #endif
} }
// basic sanity check -- are any options turned on? // basic sanity check -- are any directives enabled?
if (!(cfg->smartcheck || cfg->usagefailed || cfg->prefail || cfg->usage || cfg->selftest || cfg->errorlog || cfg->tryscsi)){ if (!(cfg->smartcheck || cfg->usagefailed || cfg->prefail || cfg->usage ||
cfg->selftest || cfg->errorlog || cfg->tryscsi)){
printout(LOG_CRIT,"Drive: %s, no monitoring Directives on line %d of file %s\n", printout(LOG_CRIT,"Drive: %s, no monitoring Directives on line %d of file %s\n",
cfg->name, cfg->lineno, CONFIGFILE); cfg->name, cfg->lineno, CONFIGFILE);
Directives(); Directives();
...@@ -1077,6 +1087,7 @@ int main (int argc, char **argv){ ...@@ -1077,6 +1087,7 @@ int main (int argc, char **argv){
con->quietmode=0; con->quietmode=0;
con->veryquietmode=debugmode?0:1; con->veryquietmode=debugmode?0:1;
// look in configuration file CONFIGFILE (normally /etc/smartd.conf) // look in configuration file CONFIGFILE (normally /etc/smartd.conf)
entries=parseconfigfile(); entries=parseconfigfile();
...@@ -1092,6 +1103,9 @@ int main (int argc, char **argv){ ...@@ -1092,6 +1103,9 @@ int main (int argc, char **argv){
signal(SIGTERM, SIG_IGN); signal(SIGTERM, SIG_IGN);
if (signal(SIGQUIT, sighandler)==SIG_IGN) if (signal(SIGQUIT, sighandler)==SIG_IGN)
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
if (signal(SIGHUP, huphandler)==SIG_IGN)
signal(SIGHUP, SIG_IGN);
// install goobye message // install goobye message
atexit(goobye); atexit(goobye);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment