[Pkg-nagios-changes] nsca/debian/patches 00list, NONE, 1.1 01_send_nsca.cfg.dpatch, NONE, 1.1 02_nsca_foreground.dpatch, NONE, 1.1

seanius at haydn.debian.org seanius at haydn.debian.org
Mon Dec 5 10:51:03 UTC 2005


Update of /cvsroot/pkg-nagios/nsca/debian/patches
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv2349/debian/patches

Added Files:
	00list 01_send_nsca.cfg.dpatch 02_nsca_foreground.dpatch 
Log Message:
ready for next upload

--- NEW FILE: 00list ---
01_send_nsca.cfg.dpatch
02_nsca_foreground.dpatch

--- NEW FILE: 01_send_nsca.cfg.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 01_send_nsca.cfg.dpatch by  <seanius at debian.org>
##
## DP: default to /etc/send_nsca.cfg instead of ./send_nsca.cfg

@DPATCH@
diff -urNad sid~/src/send_nsca.c sid/src/send_nsca.c
--- sid~/src/send_nsca.c	2003-07-24 02:08:36.000000000 +0200
+++ sid/src/send_nsca.c	2005-12-05 11:09:21.000000000 +0100
@@ -25,7 +25,7 @@
 int server_port=DEFAULT_SERVER_PORT;
 char server_name[MAX_HOST_ADDRESS_LENGTH];
 char password[MAX_INPUT_BUFFER]="";
-char config_file[MAX_INPUT_BUFFER]="send_nsca.cfg";
+char config_file[MAX_INPUT_BUFFER]="/etc/send_nsca.cfg";
 char delimiter[2]="\t";
 
 char received_iv[TRANSMITTED_IV_SIZE];

--- NEW FILE: 02_nsca_foreground.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_nsca_foreground.dpatch by  <seanius at debian.org>
##
## DP: allow nsca to run in the foreground, which makes
## DP: starting/stopping/restarting easier as we can use
## DP: external tools like s-s-d to track the pid

@DPATCH@
diff -urNad sid~/src/nsca.c sid/src/nsca.c
--- sid~/src/nsca.c	2005-12-05 11:24:12.000000000 +0100
+++ sid/src/nsca.c	2005-12-05 11:32:44.000000000 +0100
@@ -60,6 +60,8 @@
 int show_license=FALSE;
 int show_version=FALSE;
 
+int foreground=FALSE;
+
 static FILE *command_file_fp=NULL;
 
 struct handler_entry{
@@ -109,10 +111,11 @@
 	        }
 
 	if(result!=OK || show_help==TRUE){
-                printf("Usage: %s -c <config_file> [mode]\n",argv[0]);
+                printf("Usage: %s -c <config_file> [-f] [mode]\n",argv[0]);
                 printf("\n");
                 printf("Options:\n");
 		printf(" <config_file> = Name of config file to use\n");
+		printf(" [-f]        = run in the foreground, do not fork\n");
 		printf(" [mode]        = Determines how NSCA should run. Valid modes:\n");
                 printf("   --inetd     = Run as a service under inetd or xinetd\n");
                 printf("   --daemon    = Run as a standalone multi-process daemon\n");
@@ -182,7 +185,7 @@
 
         case SINGLE_PROCESS_DAEMON:
                 /* daemonize and start listening for requests... */
-                if(fork()==0){
+                if(foreground || fork()==0){
 
                         /* we're a daemon - set up a new process group */
                         setsid();
@@ -1121,6 +1124,10 @@
 		else if(!strcmp(argv[x-1],"-V") || !strcmp(argv[x-1],"--version"))
 			show_version=TRUE;
 
+		/* run in the foreground */
+		else if(!strcmp(argv[x-1],"-f"))
+			foreground=TRUE;
+
 		else if(!strcmp(argv[x-1],"-d") || !strcmp(argv[x-1],"--daemon"))
                         mode=MULTI_PROCESS_DAEMON;
 




More information about the Pkg-nagios-changes mailing list