Update of /cvsroot/perfparse/_perfparse/perfparse
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13206/perfparse
Modified Files:
log_reader.c storage.c
Log Message:
Rework periodic cleanup within storage module (perfparsed)
Index: log_reader.c
===================================================================
RCS file: /cvsroot/perfparse/_perfparse/perfparse/log_reader.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** log_reader.c 6 Jun 2007 09:53:14 -0000 1.6
--- log_reader.c 8 Dec 2007 21:25:30 -0000 1.7
***************
*** 569,581 ****
void sig_handler(int n) {
- char *sigstr[] = {"SIGINT","SIGTERM", N_("Unexpected signal")};
- int sigstrid;
- switch(n) {
- case SIGINT: sigstrid = 0; break;
- case SIGTERM: sigstrid = 1; break;
- default: sigstrid = 2;
- }
close_all_log_sources();
! pp_log(__FILE__,__LINE__,LOG_WARNING, _("Caught signal (%s)"),gettext(sigstr[sigstrid]));
exit(EXIT_FAILURE);
}
--- 569,578 ----
void sig_handler(int n) {
close_all_log_sources();
! #ifdef _GNU_SOURCE
! pp_log(__FILE__,__LINE__,LOG_WARNING, _("Caught signal %d: %s"),n,gettext(strsignal(n)));
! #else
! pp_log(__FILE__,__LINE__,LOG_WARNING, _("Caught signal %d"),n);
! #endif
exit(EXIT_FAILURE);
}
Index: storage.c
===================================================================
RCS file: /cvsroot/perfparse/_perfparse/perfparse/storage.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** storage.c 30 Jul 2007 22:32:06 -0000 1.6
--- storage.c 8 Dec 2007 21:25:30 -0000 1.7
***************
*** 281,298 ****
if(config_get_value_as_boolean(CONFIG_ITEM_ID_DROP_FILE_ROTATE)) {
/* Drop file */
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of dropfile\n"));
check_dir_for_files_to_remove_or_compress(config_get_value_as_integer(CONFIG_ITEM_ID_DROP_FILE_KEEP_N_DAYS),config_get_value_as_string(CONFIG_ITEM_ID_DROP_FILE),NULL);
}
/* Module periodic_cleanup procedures */
for(this=storage_modules; this; this = this->next) {
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage modules\n"));
if(this->module->enabled && this->module->periodic_cleanup) {
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s\n"));
! this->module->periodic_cleanup(this->module);}
! else {
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s not supported or module disabled\n"),this->module->id);
! }
}
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup finished\n"),this->module->id);
if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) {
exit(EXIT_SUCCESS);
--- 281,298 ----
if(config_get_value_as_boolean(CONFIG_ITEM_ID_DROP_FILE_ROTATE)) {
/* Drop file */
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of dropfile\n"));
check_dir_for_files_to_remove_or_compress(config_get_value_as_integer(CONFIG_ITEM_ID_DROP_FILE_KEEP_N_DAYS),config_get_value_as_string(CONFIG_ITEM_ID_DROP_FILE),NULL);
}
/* Module periodic_cleanup procedures */
for(this=storage_modules; this; this = this->next) {
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage modules\n"));
if(this->module->enabled && this->module->periodic_cleanup) {
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s\n"));
! this->module->periodic_cleanup(this->module);}
! else {
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s not supported or module disabled\n"),this->module->id);
! }
}
! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup finished\n"),this->module->id);
if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) {
exit(EXIT_SUCCESS);
|