help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to help with troubleshooting.


From: Chip Seraphine
Subject: Patch to help with troubleshooting.
Date: Fri, 17 Dec 2004 14:08:52 -0600
User-agent: Mozilla Thunderbird 0.8 (X11/20040916)

I put the following small patch in my local cfengine installation and I've found it to be quite helpful when troubleshooting. It allows you to send a SIGUSR1 to a cfengine process and automatically throw it into '-d2' mode. Sending a SIGUSR2 to the same process turns off DEBUG and D2.

Someone more familiar with the internals may want to take a look at this... I'm not confident that I am flipping all the globals that I should for this sort of thing (e.g., what about VERBOSE?)


--- cfengine-2.1.11.pristine/src/cfagent.c 2004-10-26 02:44:31.000000000 -0500
+++ cfengine-2.1.11/src/cfagent.c    2004-12-17 11:30:23.356014000 -0600
@@ -79,6 +79,8 @@
signal (SIGHUP,HandleSignal);
signal (SIGINT,HandleSignal);
signal (SIGPIPE,HandleSignal);
+signal (SIGUSR1,HandleSignal);
+signal (SIGUSR2,HandleSignal);

Initialize(argc,argv);
SetReferenceTime(true);


--- cfengine-2.1.11.pristine/src/cfenvd.c 2004-09-21 03:08:53.000000000 -0500
+++ cfengine-2.1.11/src/cfenvd.c    2004-12-17 11:32:27.299663000 -0600
@@ -488,6 +488,8 @@
signal (SIGINT,HandleSignal);
signal (SIGPIPE,HandleSignal);
signal (SIGSEGV,HandleSignal);
+signal (SIGUSR1,HandleSignal);
+signal (SIGUSR2,HandleSignal);

VCANONICALFILE = strdup("db");


--- cfengine-2.1.11.pristine/src/cfexecd.c 2004-10-30 01:32:46.000000000 -0500
+++ cfengine-2.1.11/src/cfexecd.c    2004-12-17 11:32:48.937021000 -0600
@@ -289,6 +289,8 @@
signal(SIGTERM,(void *)ExitCleanly);
signal(SIGHUP,SIG_IGN);
signal(SIGPIPE,SIG_IGN);
+signal (SIGUSR1,HandleSignal);
+signal (SIGUSR2,HandleSignal);

umask(077);


--- cfengine-2.1.11.pristine/src/cfservd.c 2004-09-20 08:47:29.000000000 -0500
+++ cfengine-2.1.11/src/cfservd.c    2004-12-17 11:33:24.810989000 -0600
@@ -562,6 +562,8 @@
signal(SIGHUP,SIG_IGN);
signal(SIGPIPE,SIG_IGN);
signal(SIGCHLD,SIG_IGN);
+signal (SIGUSR1,HandleSignal);
+signal (SIGUSR2,HandleSignal);

if (listen(sd,queuesize) == -1)
   {

--- cfengine-2.1.11.pristine/src/locks.c 2004-10-09 09:51:17.000000000 -0500
+++ cfengine-2.1.11/src/locks.c    2004-12-17 11:28:05.554163000 -0600
@@ -111,7 +111,17 @@
   CfLog(cferror,OUTPUT,"");
   fflush(stdout);
- if (signum == SIGTERM || signum == SIGINT || signum == SIGHUP || signum == SIGSEGV || signum == SIGKILL|| signum == SIGPIPE)
+   if (signum == SIGUSR1)
+      {
+      DEBUG= true;
+      D2= true;
+      }
+   else if  (signum == SIGUSR2)
+      {
+      DEBUG= false;
+      D2= false;
+      }
+ else if (signum == SIGTERM || signum == SIGINT || signum == SIGHUP || signum == SIGSEGV || signum == SIGKILL|| signum == SIGPIPE)
      {
      ReleaseCurrentLock();
      closelog();





--

Chip Seraphine
Unix Administrator
TradeLink, LLC
312-264-2048
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]