Difference between revisions of "Ns info"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 584)
 
 
(16 intermediate revisions by 5 users not shown)
Line 9: Line 9:
 
'''SYNOPSIS'''
 
'''SYNOPSIS'''
  
: '''ns_info''' ''option ?arg arg ...?''
+
: '''ns_info''' ''option''
  
 
'''DESCRIPTION'''
 
'''DESCRIPTION'''
Line 18: Line 18:
 
: returns the primary IP address of this machine, or "0.0.0.0" if unable to determine
 
: returns the primary IP address of this machine, or "0.0.0.0" if unable to determine
 
* '''ns_info argv0'''
 
* '''ns_info argv0'''
 +
 +
: returns the currently running nsd binary as launched and prior to normalizing path
 
* '''ns_info boottime'''
 
* '''ns_info boottime'''
  
Line 25: Line 27:
 
: returns the date and time at which the current server was compiled, e.g.: "Jul 20 2004 at 14:57:20"
 
: returns the date and time at which the current server was compiled, e.g.: "Jul 20 2004 at 14:57:20"
 
* '''ns_info callbacks'''
 
* '''ns_info callbacks'''
 +
 +
: returns a list of all registered startup, pre-startup, shutdown, server shutdown, exit, and SIGHUP signal procs (e.g. scripts registered for SIGHUP with ns_atsignal). Each list element is itself a 3-element list like this:
 +
::{shutdown logclose d:/AOLserver/servers/server1/modules/nslog/access1.log}
 
* '''ns_info config'''
 
* '''ns_info config'''
  
Line 39: Line 44:
 
* '''ns_info locks'''
 
* '''ns_info locks'''
  
: lists the mutexes that currently exist.  A 5-element list is returned for each mutex: ~~~ mutex name, {}, unique id, lock counter, busy counter
+
: lists the mutexes that currently exist.  A 5-element list is returned for each mutex: mutex name, {}, unique id, lock counter, busy counter
 
* '''ns_info log'''
 
* '''ns_info log'''
  
Line 56: Line 61:
 
: returns the absolute path to the currently running nsd binary
 
: returns the absolute path to the currently running nsd binary
 
* '''ns_info pageroot'''
 
* '''ns_info pageroot'''
 +
 +
: returns the absolute path to the page root
 
* '''ns_info patchlevel'''
 
* '''ns_info patchlevel'''
  
Line 66: Line 73:
 
: returns the name of the current platform, or "?" if unable to determine
 
: returns the name of the current platform, or "?" if unable to determine
 
* '''ns_info pools'''
 
* '''ns_info pools'''
 +
 +
: returns the results of Tcl_GetMemoryInfo() function if exported by the Tcl build (Tcl has to be built with thrdalloc, AOLserver has to be built with USE_THREAD_ALLOC. Works in Tcl 8.4.x. Does not work in Tcl 8.5.0 or 8.5.1, works again in Tcl 8.5.2 and later. Normally, disabled in Windows but is known to work at least with Tcl 8.5.5 or later if re-enabled in the sources and re-compiled.)
 
* '''ns_info scheduled'''
 
* '''ns_info scheduled'''
 +
 +
: returns a list of all scheduled tasks in the current process (all virtual servers).  Each list element is itself a 9-element list of {id, flags, interval, nextqueue, lastqueue, laststart, lastend, procname, arg}:
 +
:* id - unique id returned by the scheduling command
 +
:* flags - Bitmap of one or more of:
 +
:** 1 -- NS_SCHED_THREAD
 +
:** 2 -- NS_SCHED_ONCE
 +
:** 4 -- NS_SCHED_DAILY
 +
:** 8 -- NS_SCHED_WEEKLY
 +
:** 16 - NS_SCHED_PAUSED
 +
:** 32 - NS_SCHED_RUNNING
 +
:* interval - interval specification (i.e. seconds from midnight for daily schedule)
 +
:* nextqueue - Next time to queue for run
 +
:* lastqueue - Last time queued for run
 +
:* laststart - Last time run started
 +
:* lastend - Last time run finished
 +
:* procname - for tasks scheduled with [[ns_schedule_proc]] this will be ns:tclschedproc and arg will be the actual scheduled tcl script.
 +
:* arg - client data
 +
: Example:
 +
::{4 4 10800 1254650400 1254564000 1254564000 1254564004 logroll d:/AOLserver/servers/dncscrub1/modules/nslog/access.log}
 
* '''ns_info server'''
 
* '''ns_info server'''
 +
 +
: returns the name of the current virtual server.  During the bootstrap process, when processing the config file, ns_info server returns the value of the -s parameter in AOLserver builds after 2004-12-02.
 
* '''ns_info servers'''
 
* '''ns_info servers'''
 +
 +
: returns a list of virtual servers in the current nsd process
 
* '''ns_info sockcallbacks'''
 
* '''ns_info sockcallbacks'''
 +
 +
: returns a list of all socket callbacks such as the socket listening callback for the nscp module. Each list element is itself a 4-element list like this:
 +
::{540 {read exit} nscp {127.0.0.1 9999}}
 
* '''ns_info tag'''
 
* '''ns_info tag'''
  
 
: returns the CVS tag (NSD_TAG from nsd.h); not guaranteed to be useful
 
: returns the CVS tag (NSD_TAG from nsd.h); not guaranteed to be useful
 +
 
* '''ns_info tcllib'''
 
* '''ns_info tcllib'''
 +
 +
: returns the path the virtual server's private tcl library - identical to [ [[ns_library]] private ]
 
* '''ns_info threads'''
 
* '''ns_info threads'''
 +
 +
: returns a list of all threads in the current process (all virtual servers).  Each list element is itself a 7-element list of {name, parent, id, flag, ctime, procname, arg}:
 +
:* name - current name of the thread
 +
:* parent - parent thread name
 +
:* id - id of the thread
 +
:* flag - 1 if this is a detached thread, 0 otherwise
 +
:* ctime - Thread creation time
 +
:* procname - for conn threads this will be ns:connthread
 +
:* arg - client data - for a running conn thread arg will be a 7-element list in the format returned by [[ns_server]] all - {conn id, peeraddr, state, method, url, running time, bytes sent}, where state is either "running" or "queued":
 +
:: {-default:3- -nssock:driver- 15480 0 1254437214 ns:connthread {3536 192.168.0.1 running GET /_stats 0.15624 0}}
 +
:: Note that running time is returned in seconds.microseconds format which is misleading because 0.100 does not mean a tenth of a second, it means 100 microseconds.
 
* '''ns_info uptime'''
 
* '''ns_info uptime'''
 +
 +
: returns the number of seconds since the process started
 
* '''ns_info version'''
 
* '''ns_info version'''
 +
 +
: returns the major.minor version string (i.e. 4.5)
 
* '''ns_info winnt'''
 
* '''ns_info winnt'''
 +
 +
: returns 1 if the platform is Windows, 0 otherwise
  
 
'''EXAMPLES'''
 
'''EXAMPLES'''
Line 85: Line 140:
 
----
 
----
  
[[Category Documentation]] - [[Category Core Tcl API]]
+
[[Category:Documentation]] - [[Category:Core Tcl API]]

Latest revision as of 18:47, 12 October 2009

Man page: http://aolserver.com/man/4.0/tcl/ns_info.html


NAME

ns_info - Return information about various aspects of the running AOLserver

SYNOPSIS

ns_info option

DESCRIPTION

This command provides information about the current state of the running AOLserver. The legal options (which may be abbreviated) are:
  • ns_info address
returns the primary IP address of this machine, or "0.0.0.0" if unable to determine
  • ns_info argv0
returns the currently running nsd binary as launched and prior to normalizing path
  • ns_info boottime
returns the time in epoch seconds since the current server was started
  • ns_info builddate
returns the date and time at which the current server was compiled, e.g.: "Jul 20 2004 at 14:57:20"
  • ns_info callbacks
returns a list of all registered startup, pre-startup, shutdown, server shutdown, exit, and SIGHUP signal procs (e.g. scripts registered for SIGHUP with ns_atsignal). Each list element is itself a 3-element list like this:
{shutdown logclose d:/AOLserver/servers/server1/modules/nslog/access1.log}
  • ns_info config
returns the absolute path to the config file used to start the server
  • ns_info home
returns the current working directory of the server
  • ns_info hostname
returns the value of gethostname(), or "localhost" if that fails
  • ns_info label
returns the value of NSD_LABEL from nsd.h, e.g. "aolserver4_0"
  • ns_info locks
lists the mutexes that currently exist. A 5-element list is returned for each mutex: mutex name, {}, unique id, lock counter, busy counter
  • ns_info log
returns the name of the error log specified by the "serverlog" parameter in the "ns/parameters" section, or "server.log" if not defined. Prepends the server's current working directory
  • ns_info major
returns the value of NS_MAJOR_VERSION from ns.h, e.g. "4"
  • ns_info minor
returns the value of NS_MINOR_VERSION from ns.h, e.g. "0"
  • ns_info name
returns the value of NSD_NAME from nsd.h (currently 'AOLserver')
  • ns_info nsd
returns the absolute path to the currently running nsd binary
  • ns_info pageroot
returns the absolute path to the page root
  • ns_info patchlevel
returns the value of NS_PATCH_LEVEL from ns.h, e.g. "4.0.7"
  • ns_info pid
returns the process ID of the current nsd process
  • ns_info platform
returns the name of the current platform, or "?" if unable to determine
  • ns_info pools
returns the results of Tcl_GetMemoryInfo() function if exported by the Tcl build (Tcl has to be built with thrdalloc, AOLserver has to be built with USE_THREAD_ALLOC. Works in Tcl 8.4.x. Does not work in Tcl 8.5.0 or 8.5.1, works again in Tcl 8.5.2 and later. Normally, disabled in Windows but is known to work at least with Tcl 8.5.5 or later if re-enabled in the sources and re-compiled.)
  • ns_info scheduled
returns a list of all scheduled tasks in the current process (all virtual servers). Each list element is itself a 9-element list of {id, flags, interval, nextqueue, lastqueue, laststart, lastend, procname, arg}:
  • id - unique id returned by the scheduling command
  • flags - Bitmap of one or more of:
    • 1 -- NS_SCHED_THREAD
    • 2 -- NS_SCHED_ONCE
    • 4 -- NS_SCHED_DAILY
    • 8 -- NS_SCHED_WEEKLY
    • 16 - NS_SCHED_PAUSED
    • 32 - NS_SCHED_RUNNING
  • interval - interval specification (i.e. seconds from midnight for daily schedule)
  • nextqueue - Next time to queue for run
  • lastqueue - Last time queued for run
  • laststart - Last time run started
  • lastend - Last time run finished
  • procname - for tasks scheduled with ns_schedule_proc this will be ns:tclschedproc and arg will be the actual scheduled tcl script.
  • arg - client data
Example:
{4 4 10800 1254650400 1254564000 1254564000 1254564004 logroll d:/AOLserver/servers/dncscrub1/modules/nslog/access.log}
  • ns_info server
returns the name of the current virtual server. During the bootstrap process, when processing the config file, ns_info server returns the value of the -s parameter in AOLserver builds after 2004-12-02.
  • ns_info servers
returns a list of virtual servers in the current nsd process
  • ns_info sockcallbacks
returns a list of all socket callbacks such as the socket listening callback for the nscp module. Each list element is itself a 4-element list like this:
{540 {read exit} nscp {127.0.0.1 9999}}
  • ns_info tag
returns the CVS tag (NSD_TAG from nsd.h); not guaranteed to be useful
  • ns_info tcllib
returns the path the virtual server's private tcl library - identical to [ ns_library private ]
  • ns_info threads
returns a list of all threads in the current process (all virtual servers). Each list element is itself a 7-element list of {name, parent, id, flag, ctime, procname, arg}:
  • name - current name of the thread
  • parent - parent thread name
  • id - id of the thread
  • flag - 1 if this is a detached thread, 0 otherwise
  • ctime - Thread creation time
  • procname - for conn threads this will be ns:connthread
  • arg - client data - for a running conn thread arg will be a 7-element list in the format returned by ns_server all - {conn id, peeraddr, state, method, url, running time, bytes sent}, where state is either "running" or "queued":
{-default:3- -nssock:driver- 15480 0 1254437214 ns:connthread {3536 192.168.0.1 running GET /_stats 0.15624 0}}
Note that running time is returned in seconds.microseconds format which is misleading because 0.100 does not mean a tenth of a second, it means 100 microseconds.
  • ns_info uptime
returns the number of seconds since the process started
  • ns_info version
returns the major.minor version string (i.e. 4.5)
  • ns_info winnt
returns 1 if the platform is Windows, 0 otherwise

EXAMPLES

SEE ALSO


-