Hi, I am using two nsd instances to run two different nameservers on the same machine. Since both need to have proper initscript support, I have made a hardlink under a different name to /usr/sbin/nsd, and initscripts can use my new name "nsdhm", and do things like "pidof nsdhm". I got very confused when my i saw "nsd" started to fail, and it took me a while to figure out it was my nsdhm that had failed to start. Attached patch changes some of the log entries to use argv[0] instead of the string "nsd" for logging. Paul -------------- next part -------------- diff -Naur nsd-3.2.2/nsd.c nsd-3.2.2.new/nsd.c --- nsd-3.2.2/nsd.c 2009-05-18 09:17:47.000000000 -0400 +++ nsd-3.2.2.new/nsd.c 2009-07-15 16:51:03.112382117 -0400 @@ -810,8 +810,8 @@ } else { if (kill(oldpid, 0) == 0 || errno == EPERM) { log_msg(LOG_WARNING, - "nsd is already running as %u, continuing", - (unsigned) oldpid); + "%s is already running as %u, continuing", + argv[0], (unsigned) oldpid); } else { log_msg(LOG_ERR, "...stale pid file from process %u", @@ -880,12 +880,12 @@ /* Run the server... */ if (server_init(&nsd) != 0) { - log_msg(LOG_ERR, "server initialization failed, nsd could " - "not be started"); + log_msg(LOG_ERR, "server initialization failed, %s could " + "not be started",argv[0]); exit(1); } - log_msg(LOG_NOTICE, "nsd started (%s), pid %d", PACKAGE_STRING, + log_msg(LOG_NOTICE, "%s started (%s), pid %d", argv[0], PACKAGE_STRING, (int) nsd.pid); if (nsd.server_kind == NSD_SERVER_MAIN) {
At Wed, 15 Jul 2009 18:56:05 -0400 (EDT), Paul Wouters <paul at xelerance.com> wrote: Subject: [nsd-users] patch for nsd using hardcoded name "nsd"> > Attached patch changes some of the log entries to use argv[0] instead > of the string "nsd" for logging.That's a very good idea! Assuming the final pathname in argv[0] is sufficient for differentiation in the logs, this expression will provide the appropriate pointer to just that final pathname component: char *argv0 = (argv0 = strrchr(argv[0], '/')) ? argv0 + 1 : argv[0]; -- Greg A. Woods +1 416 218-0098 VE3TCP RoboHack <woods at robohack.ca> Planix, Inc. <woods at planix.com> Secrets of the Weird <woods at weird.com> -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available URL: <http://lists.nlnetlabs.nl/pipermail/nsd-users/attachments/20090715/d2ba4fdf/attachment.bin>
Paul Wouters schreef:> > Hi, > > I am using two nsd instances to run two different nameservers on the > same machine. Since both need to have proper initscript support, I > have made a hardlink under a different name to /usr/sbin/nsd, and > initscripts can use my new name "nsdhm", and do things like "pidof nsdhm". > > I got very confused when my i saw "nsd" started to fail, and it took > me a while to figure out it was my nsdhm that had failed to start. > > Attached patch changes some of the log entries to use argv[0] instead > of the string "nsd" for logging. > > Paul >Wouldn't it be much easier and cleaner to make both instances write to a separate logfile, /var/log/nsd vs /var/log/nsdhm (or whatever you're preferred name would be)? There are many (linux) distributions that support multiple instances of the same server (with multiple config files) out of the box in their init scripts. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 258 bytes Desc: OpenPGP digital signature URL: <http://lists.nlnetlabs.nl/pipermail/nsd-users/attachments/20090716/909c06ae/attachment.bin>