[master] add OS details to rndc status

4325.	[func]		Add a line to "rndc status" indicating the
			hostname and operating system details. [RT #41610]
This commit is contained in:
Evan Hunt 2016-03-03 22:02:52 -08:00
parent 44c86318ed
commit 023ba1e6ef
3 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,6 @@
4325. [func] Add a line to "rndc status" indicating the
hostname and operating system details. [RT #41610]
4324. [bug] When deleting records from a zone database, interior
nodes could be left empty but not deleted, damaging
search performance afterward. [RT #40997]

View file

@ -8924,7 +8924,7 @@ ns_server_status(ns_server_t *server, isc_buffer_t **text) {
const char *ob = "", *cb = "", *alt = "";
char boottime[ISC_FORMATHTTPTIMESTAMP_SIZE];
char configtime[ISC_FORMATHTTPTIMESTAMP_SIZE];
char line[1024];
char line[1024], hostname[256];
if (ns_g_server->version_set) {
ob = " (";
@ -8955,6 +8955,13 @@ ns_server_status(ns_server_t *server, isc_buffer_t **text) {
ns_g_description, ns_g_srcid, ob, alt, cb);
CHECK(putstr(text, line));
result = ns_os_gethostname(hostname, sizeof(hostname));
if (result != ISC_R_SUCCESS)
strlcpy(hostname, "localhost", sizeof(hostname));
snprintf(line, sizeof(line), "running on %s: %s\n",
hostname, ns_os_uname());
CHECK(putstr(text, line));
snprintf(line, sizeof(line), "boot time: %s\n", boottime);
CHECK(putstr(text, line));

View file

@ -441,4 +441,11 @@ $RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf reconfig > /dev/null 2>&1 && r
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:test rndc status shows running on"
ret=0
$RNDC -s 10.53.0.5 -p 9953 -c ../common/rndc.conf status > rndc.output /dev/null 2>&1 || ret=1
grep "^running on " rndc.output > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
exit $status