From 1ee7b4bb5336b0a8a7b39867dfb738b93ed5c426 Mon Sep 17 00:00:00 2001 From: octo Date: Sat, 17 Dec 2005 19:08:31 +0000 Subject: [PATCH] Changed default `host' for `mysql' to `localhost' Added SIGTERM handler Updated `ChangeLog' --- ChangeLog | 6 ++++++ configure.in | 2 +- src/collectd.c | 12 +++++++++++- src/mysql.c | 5 ++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6a591f3..7bffaa82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-12-17, Version 3.6.0 + * A config file has been added. This allows for loading only specific + plugins. + * A `mysql' plugin has been added. + * A signal handler for SIGTERM has been added. + 2005-12-07, Version 3.5.0 (Revision 326) * A bug in the `load' module under Solaris has been fixed. * The `users' module has been contributed by Sebastian Harl. It counts diff --git a/configure.in b/configure.in index 8d90a9e6..15903be9 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(collectd, 3.5.0) +AC_INIT(collectd, 3.6.alpha0) AC_CONFIG_SRCDIR(src/collectd.c) AC_CONFIG_HEADERS(src/config.h) AM_INIT_AUTOMAKE(dist-bzip2) diff --git a/src/collectd.c b/src/collectd.c index c86a6780..e8081785 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -55,6 +55,11 @@ static void sigIntHandler (int signal) loop++; } +static void sigTermHandler (int signal) +{ + loop++; +} + static int change_basedir (char *dir) { int dirlen = strlen (dir); @@ -256,7 +261,9 @@ static int pidfile_remove (const char *file) int main (int argc, char **argv) { - struct sigaction sigIntAction, sigChldAction; + struct sigaction sigIntAction; + struct sigaction sigTermAction; + struct sigaction sigChldAction; char *configfile = CONFIGFILE; char *plugindir = PLUGINDIR; char *datadir = PKGLOCALSTATEDIR; @@ -380,6 +387,9 @@ int main (int argc, char **argv) sigIntAction.sa_handler = sigIntHandler; sigaction (SIGINT, &sigIntAction, NULL); + sigIntAction.sa_handler = sigTermHandler; + sigaction (SIGTERM, &sigTermAction, NULL); + sigChldAction.sa_handler = SIG_IGN; sigaction (SIGCHLD, &sigChldAction, NULL); diff --git a/src/mysql.c b/src/mysql.c index 1ac62e98..bd9685b6 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -39,7 +39,7 @@ #define BUFSIZE 512 -static char *host; +static char *host = "localhost"; static char *user; static char *pass; static char *db = NULL; @@ -126,7 +126,10 @@ static void init (void) if (getconnection () != NULL) init_suceeded = 1; else + { + syslog (LOG_ERR, "The `mysql' plugin will be disabled because `init' failed to connect to `%s'", host); init_suceeded = 0; + } #endif /* MYSQL_HAVE_READ */ return; -- 2.11.0