# phpman > man > nnadmin(1M)

[NNADMIN(1m)](https://www.chedong.com/phpMan.php/man/NNADMIN/1m/markdown)                                                                              [NNADMIN(1m)](https://www.chedong.com/phpMan.php/man/NNADMIN/1m/markdown)



## NAME
       nnadmin - nn database administration

## SYNOPSIS
       **nnadmin** [ _commands_ ]

## DESCRIPTION
       _nnadmin_  is  a  control program for the [_nnmaster_(1M)](https://www.chedong.com/phpMan.php/man/nnmaster/1M/markdown) daemon which is responsible for building
       and maintaining the database used by the [_nn_(1)](https://www.chedong.com/phpMan.php/man/nn/1/markdown) news reader.

       _nnadmin_ allows you to display extracts from the log file, display the "raw" contents  of  the
       database,  make  consistency  checks on the database, instruct the running _nnmaster_ to expire
       one or more groups, alter the options of the running _nnmaster_, and much more.

       _nnadmin_ runs in two modes: interactive and non-interactive.

       In interactive mode, simple one line menus are used to show the  available  operations  which
       are then selected by typing the letter associated with the command (normally the first letter
       in the command name).

       In non-interactive mode, the _commands_ argument will be used as a series of key-strokes  which
       are  interpreted exactly as if they were typed in from the keyboard in interactive mode.  For
       example, to stop the _nnmaster_, the following invocation of nnadmin can be used:
            _nnadmin_ MK
       which will select the (M)aster submenu from the main menu, and then the (K)ill entry from the
       submenu.

       In  non-interactive mode, the menus are not displayed and the commands are not echoed!  _nnad__‐
       _min_ will exit when there are no more key-strokes to be read from the _commands_  argument.   It
       is  not  possible to specify a group name in the _commands_ argument, so the functionalities of
       _nnadmin_ that relates to specific groups are only available in interactive mode.

       Some "dangerous" commands will require that you confirm them by following them by "Y" on  the
       command  line.   The  most  noteable are IY (initialize database) and EY (expire all groups).
       These commands will be marked with a **[Y]** following the command name.

       You can also invoke an interactive _nnadmin_ using the **:admin** command in _nn_.

## SHELL ESCAPES
       At all prompts you can hit `!' to spawn a subshell.

       The working directory of the subshell will be changed to the database directory when  invoked
       from  the MASTER or DUMP menus, and it will changed to the group's spool directory (if it ex‐
       ists) when invoked from the GROUP menu.

## MAIN MENU
       From the main menu (identified by the **ADMIN** prompt) you can select the following operations:

### C)onf
              Show current configuration parameters such as directories,  files,  programs,  network
              usage, etc.

### E)xpire [Y]
              Send  a  request to the _nnmaster_ daemon to schedule (and run) expire for all groups in
              the database.

### G)roups
              Enter the GROUP submenu.

### I)nit [Y]
              Send a request to the _nnmaster_ daemon to recollect all groups in the database.

### L)og
              Enter the LOG submenu.

### M)aster
              Enter the MASTER submenu.

### Q)uit
              Quit _nnadmin_.

### S)tat
              Print general statistics about the database.  See the section on  Database  Statistics
              below.

### U)pdate
              Update the incore copy of the database master index.

### V)alidate
              Make  a thorough consistency check on the database.  If inconsistencies are found in a
              group, you will be asked whether a request should be sent to the  _nnmaster_  daemon  to
              recollect  the group (in non-interactive mode, requests will be sent automatically for
              all corrupted groups).

### W)akeup
              Send a wakeup signal to the _nnmaster_ daemon to have it receive messages  sent  to  it,
              perform the required actions, and then collect articles as necessary.

       **Z** (silent validation)
              This  operation  is identical to the Validate operation, expect that no output is pro‐
              duced during the consistency check; this operation is used by the _nnmaster_ to  execute
              the -**C** option.

## THE MASTER MENU
       The  master menu (identified by the **MASTER** prompt) provides access to overall database infor‐
       mation, and to send control messages to the _nnmaster_ daemon.

       **C)heck** In interactive mode and in verbose batch mode (_nnadmin_ MC), print  a  message  telling
              whether  _nnmaster_  is  running or not.  In silent batch mode (_nnadmin_ =MC) exit with a
              status code of 0 if _nnmaster_ is running and 1 otherwise; this may be useful is  admin‐
              istrative scripts.

       **D)ump**  Enter the DUMP submenu.

### F)iles
              Print a listing (using [_ls_(1)](https://www.chedong.com/phpMan.php/man/ls/1/markdown)) of all the data and index files in the database.

### G)roup
              Print  the master index entry for a single group identified by its internal group num‐
              ber.

### K)ill
              Stop the _nnmaster_ when it has finished its current task.

### O)ptions
              Change the runtime options of the running _nnmaster_ daemon.  Currently, only the  value
              of the -r and -e options can be modified.

### S)tat
              Print  general  statistics about the database.  See the section on Database Statistics
              below.

### T)race
              Turn the trace option -t on or off in the running _nnmaster_.

## THE DUMP MENU
       The dump menu (identified by the **DUMP** prompt) allows you to print the master index entry  for
       various selections of groups in the database.

### A)ll
              Print all groups in the database.

### E)mpty
              Print the empty groups in the database.

       **H)oles** Print  the  groups  where  the `min' field in the active file is not the first article
              saved in the database (because it doesn't exist or because  it  is  ignored  for  some
              other reason, e.g. bad or old).

### I)gnored
              Print  groups  which  are  ignored, either in the GROUPS file or because of some other
              condition (mainly no spool directory).

### N)on-empty
              Print the non-empty groups in the database.

       **V)alid** Print the groups which are present in the active file.

### in(W)alid
              Print the groups in the database which are not present in the active file.

## THE LOG MENU
       The log menu (identified by the **LOG** prompt) enables you the extract specific entries from the
       log file, and to truncate the log file.

       The entries in the log file share the following format:
            <class>: <date> <time> (<user>): <message>
       where  <class> identifies the message class, the <date> and <time> specify when the entry was
       made, the <user> specifies who created the entry (the letter "M" denote  the  _nnmaster_),  and
       the <message> is the text of the entry.

       To  extract the log file entries of a specific class, simply enter the letter identifying the
       class:

### A - admin to master communication
              This class of messages are related to the sending of messages from an _nnadmin_  program
              to the _nnmaster_ daemon.

### B - bad articles
              Reports  about  bad  articles which have been ignored or removed (controlled by the -**b**
              and -**B** options to _nnmaster_).

### C - collection statistics
              Statistics about collection of new articles.  The message has the format:
                   Collect: _nnn_ art, _ppp_ gr, _ttt_ s
              meaning that _nnn_ articles in _ppp_ groups were collected in _ttt_ seconds (real time).

### E - fatal errors
              Fatal errors encountered during operation.  These errors require  manual  intervention
              to be fixed (some of the fatal errors occur if thing that "cannot happen" happens any‐
              way, and may indicate a bug in the software).

### M - nnmaster messages.
              Master start/stop messages.

### N - NNTP related messages
              Various messages related to the NNTP part of the nnmaster, mostly about  lost  connec‐
              tions  and  failed attempts to connect to the NNTP server.  These messages should only
              appear if you use NNTP, and your NNTP server is down for some reason.

### O - old articles
              Reports related to ignoring (and removing) old articles  when  building  the  database
              (controlled by the -**O** and -**B** options to _nnmaster_).

### R - reports
              Non-fatal  error  which  enables the _nnmaster_ to continue operation, but may prevent a
              user to run _nn_ (file access problems).  Reported problems should be checked.  The most
              common report message will probably be
                   some.group: no directory
              which  indicates  that the spool directory for that group has disappeared (most likely
              because it has been rmgroup'ed).

### T - trace output
              Messages produced as a result of using the -t option on the _nnmaster_.  This is primar‐
              ily for debugging purposes.

### U - usage statistics
              If _nn_ is compiled with the STATISTICS option enabled, an entry will be made in the log
              file every time a user has spent more than five minutes on news reading.  The  message
              will have the following format:
                   USAGE _hours.minutes_
              Since it is possible to suspend _nn_, or leave the terminal while _nn_ is active, _nn_ tries
              to be intelligent when it calculates the usage time so it will reflect the actual time
              spent  on  news reading.  The usage statistics can be summarized using the [_nnusage_(1M)](https://www.chedong.com/phpMan.php/man/nnusage/1M/markdown)
              program.

### V - validation errors
              When inconsistencies are detected in the database during validation, an entry for each
              corrupted group will be entered in the log file.

### X - expire statistics
              Messages  similar  to the Collect statistics reporting the result of running expire on
              the database.  Reports related to ignoring, removing, renumbering, and reactivation of
              groups are also given class X.

       To  extract  a  specific  entry class, [_grep_(1)](https://www.chedong.com/phpMan.php/man/grep/1/markdown) is used, so it may take a while on a large log
       file.

       There are also a few special operations on the log file:

### G)roup
              Extract the entries which refers to a specified group.

### (1-9) tail
              Invoke [_tail_(1)](https://www.chedong.com/phpMan.php/man/tail/1/markdown) to extract the last 10-90 entries in the log file.

### space
              Equivalent to **1** (list last 10 lines of log).

### (.) all
              Display the complete log file.

### (@) clean [Y]
              Move the Log file to Log.old, and create a new empty Log file.  If you want  to  clean
              out  the  old log file as well, simply repeat the clean operation (this will result in
              an empty Log.old file.)

## THE GROUP MENU
       When you enter the group menu (identified by the **GROUP** prompt), _nnadmin_ will prompt  you  for
       the  name of a news group, which you can enter with the usual completion feature described in
       the [_nn_(1)](https://www.chedong.com/phpMan.php/man/nn/1/markdown) manual.  You can then perform the following operations on the specified group:

       **C)lear**___**flag**
              Clear a group specific flag.  See the section on group flags below.

### D)ata
              Dump the contents of the data file containing the extracted article  headers  for  the
              group.

### E)xpire
              Request the _nnmaster_ to run expire on the group.

### F)iles
              List the files (using [_ls_(1)](https://www.chedong.com/phpMan.php/man/ls/1/markdown)) containing the index and data for the group.

### G)roup
              Switch to another group.

### H)eader
              Dump the master index entry for the group.

### R)ecollect
              Request the _nnmaster_ to recollect all articles in the group.

       **S)et**___**flag**
              Set a group specific flag.  See the section on group flags below.

### V)alidate
              Perform validation on the group's database information.

### Z)ap [Y]
              Remove group from news system - this will be done by running the _rmgroup_ program which
              must reside in the NEWS_LIB directory.  Of course, this should be done with great cau‐
              tion.

## INDIVIDUAL GROUP FLAGS
       You  can set and clear the following flags for individual groups to control the future behav‐
       iour of _nnmaster_ on that group.

       Notice that these flags will be reset to their default value if you reinitialize the database
       using  _nnmaster_  -I.  To change these flags permanently, they should be set or cleared in the
       GROUPS file.

       **A)lways**___**digest**
              Normally, _nnmaster_ will only attempt to split digests into individual articles  if  it
              can easily recognize an article as a digest.  This requires that the word "digest" ap‐
              pears somewhere in the subject line, and that one of the first few lines in  the  body
              of the article loosely matches the subject.  A few news groups frequently receives di‐
              gests which break one or both of these requirements.  To have _nnmaster_ split these di‐
              gests  into  individual  articles  anyway, you can turn on the "always digest" flag on
              these news groups.  This will instruct _nnmaster_ to treat _all_ articles in the group  as
              digests  (naturally,  articles  which are then found not to contain other articles are
              still treated as normal articles.)

### C)ontrol
              This is a special flag for the control group.  It  indicates  that  the  "Newsgroups:"
              field in the article header cannot be trusted (it does not specify the groups to which
              the article has been posted.)

### D)irectory missing
              This flag indicates that the spool directory for the news group cannot be  found  (the
              group has probably been removed with [_rmgroup_(1M)](https://www.chedong.com/phpMan.php/man/rmgroup/1M/markdown)).  It is set automatically be the _nn__‐
              _master_ if it cannot access the directory.  When the flag is set,  _nnmaster_  completely
              ignores  the  group,  so it can be used to disable news collection in specific groups.
              If you recreate the group or the directory manually, you must also clear this flag  to
              have the _nnmaster_ recognize the group again.

### M)oderated
              Indicates  that  the  group is moderated.  This flag is normally initialized automati‐
              cally from the active file, and it should not be changed lightly.

       **N)ever**___**digest**
              This is the opposite of the "always digest" flag; when set, the  _nnmaster_  will  never
              attempt to split any articles in that group into subarticles.

## DATABASE STATISTICS DISPLAY
       When  you  select the (S)tat operation in the main or master menus, you will get some general
       statistics about the database:

       initialized
              The time when the database was last rebuild using _nnmaster_ -I.

       last_scan, last_size
              The time stamp on the active file and its size the last time the _nnmaster_ read it.

       no of groups
              The total number of groups in the database.

       Articles
              The total number of articles in all groups.  This is not an exact number,  because  it
              will count split digests as a single article (making the number too small), and it may
              count some articles that have been expired (making the number too large).

       Disk usage
              The total number of (1 kbyte) disk blocks occupied by the database.

## MASTER INDEX ENTRIES
       The master index entries displayed when you select the (H)eader operation in the  master  and
       group menus contain the following information:

       _group_name_  _group_number_
              The  first  line of the display will show the name of the group and the internal group
              number which is used to identify the group in the database.

       first/last art
              This is the numbers of the first and last article that are  currently  stored  in  the
              database.

       active info
              This  is the numbers of the first and last article in the news system as read from the
              active file.  They will normally match the numbers above, but they  may  differ  while
              the  _nnmaster_ is working on the group (or it has not yet collected all the articles in
              the group).

       Offsets: index->..., data->...
              These values show the starting position for the next write operation on the index  and
              data  files.   They  are  primarily used for consistency checking and recovery after a
              system crash, but after an "expire by rewrite" operation (expire method  2)  which  is
              performed "in-situ", the data and index files may physically be longer than the actual
              data stored in them.

       Flags:
              This shows the current flags set for this group.  If no flags are set,  the  field  is
              omitted from the display.  One extra flag which was not explained above is the BLOCKED
              flag; it is a temporary locking flag set on a group by the _nnmaster_ while it is updat‐
              ing the database files for that group to prevent _nn_ clients to access that group.

## RAW DATABASE DISPLAY
       When  you  select  the (D)ata operation on the group menu, you will get a combined display of
       the raw data and index files for that group.  The index file contains a single 32  bit  value
       for each existing article number.  This value is an offset into the data file pointing to the
       header for the corresponding article.

       When _nn_ want to access the article from number N to the last article, it looks up the  offset
       for article number N in the index file, and uses this as the starting point for reading arti‐
       cle header information in the data file.  It then simply reads to the end of the data file in
       which  the  article headers for articles number N+1, N+2, and so on follows immediately after
       the header for article number N.

       The article header information is presented in a very terse form; each of  the  output  lines
       are described below for reference purposes:

       offset = _xxxx_    , article # = _nnnnn_   (type)
              This shows the offset into the data file and the article number.  The offset is stored
              in the index file for quick access.  If no _type_ is printed it  is  a  normal  article.
              Other types are: "digest header" and "digest sub-article".

       xpost(_count_):  _nnn_, _nnn_, _nnn_, ...
              Cross-postings to other groups are encoded as a list of internal group numbers.

       ts=_nn_ hp=_nn_ fp=_nn_ lp=_nn_ ref=_nn_[+Re] lines=_nn_
              These values are used by _nn_ to sort, present, and access an article:
              **ts**  is  the _time_ _stamp_ on the article; it is a simple encoding of the posting date and
              time found in the Date: field.
              **hp**, **fp**, and **lp** are offsets into the file containing the article text: the _header_ _posi__‐
              _tion_,  _first_ _text_ _position_, and _last_ _text_ _position_.  The first will be zero for normal
              articles, but not for articles in a split digest.  The  last  will  be  equal  to  the
              length of the file for normal articles, but not inside digests.
              **ref**  is the number of references on the Reference: line.  If "+Re" follows the number,
              the subject line contained a "Re:" prefix which has been removed.

       Sender(_length_): _name_
              The name of the sender in "ready to print" format, i.e. reduced to  16  characters  as
              explained in the _nn_ manual.

       Subj(_length_): _subject_
              This is the full subject line from the article header (except for Re: prefixes in var‐
              ious formats).

## FILES
       The $db, $lib, and $news used below are synonyms for the DB_DIRECTORY, LIB_DIRECTORY, and the
       news system's lib directories respectively.
       $db/MASTER        Database master index
       $db/GROUPS        News group names in MASTER file order
       $db/DATA/_nnn_.x    Index file for group number _nnn_
       $db/DATA/_nnn_.d    Data file for group number _nnn_
       $master/GATE      Message channel from _nnadmin_ to _nnmaster_
       $master/MPID      The process id of the _nnmaster_ daemon.
       $Log              The log file (truncate it regularly!)

       The  MASTER file contains a record for each news group, occurring in the same sequence as the
       group names in the GROUPS file.  The sequence also defines the group numbers used to identify
       the files in the database and in a few other places.

       The  GATE  file  will  be created by _nnadmin_ when needed, and removed by _nnmaster_ when it has
       read it.  Therefore, to send a message to the _nnmaster_ requires that you are allowed to write
       in the $master directory.

## SEE ALSO
       [nn(1)](https://www.chedong.com/phpMan.php/man/nn/1/markdown), [nncheck(1)](https://www.chedong.com/phpMan.php/man/nncheck/1/markdown), [nngrep(1)](https://www.chedong.com/phpMan.php/man/nngrep/1/markdown), [nntidy(1)](https://www.chedong.com/phpMan.php/man/nntidy/1/markdown)
       [nnquery(1M)](https://www.chedong.com/phpMan.php/man/nnquery/1M/markdown), [nnusage(1M)](https://www.chedong.com/phpMan.php/man/nnusage/1M/markdown), [nnmaster(8)](https://www.chedong.com/phpMan.php/man/nnmaster/8/markdown)

## WARNINGS
       The  GATE  file  is  created with the owner and modes of the user that runs _nnadmin_ which may
       cause problems if the owner of the _nnmaster_ process (normally "news") is not allowed to  read
       the  created  GATE  file (a "umask" of 022 is ok.)  Unless you allow ordinary users to create
       files in the LIB directory where the GATE file resides, only the owner of the directory (nor‐
       mally  "news") and "root" can use _nnadmin_ to send messages to the _nnmaster_.  However, to send
       a wakeup signal to the master, anybody can run
            _nnmaster_ -w

## BUGS
       The user interface is completely out of line with the rest of the _nn_ family, and the  way  to
       run  _nnadmin_ in the non-interactive mode is a bit bizarre.  This is not likely to change, be‐
       cause I believe there are more important things to do!

## AUTHOR
       Kim F. Storm, Texas Instruments A/S, Denmark
       E-mail: <storm@texas.dk>



4th Berkeley Distribution                    Release 6.6                                 [NNADMIN(1m)](https://www.chedong.com/phpMan.php/man/NNADMIN/1m/markdown)
