## Administration ¶

NNCP uses following files/directories you should be aware of:

- Configuration file file, for example `/usr/local/etc/nncp.hjson`. Should not be globally readable, because it contains private keys.
- Spool directory directory with inbound/outbound encrypted packets, for example `/var/spool/nncp`.

  It also contains temporary files (in `tmp/` directory), possibly left alone, if some of the commands failed and prematurely exited and that should be cleaned from time to time.

  Partly transferred files are stored with `.part` suffix. And possibly they also require cleanup if they are completely lost.

  It can contain `.nock` files: fully downloaded, but still not checksummed. Can be checksummed (with `.nock` extension removing) with `nncp-check -nock`.

  Also it can contain `seen/` and `hdr/` subdirectories, that should be cleaned too from time to time.

  All of that cleaning tasks can be done with `nncp-rm` utility.

  If you want to share single spool directory with multiple grouped Unix users, then you can `setgid` it and assure that umask is group friendly. For convenience you can set `umask` globally for invoked NNCP commands in the configuration file. For example:

      $ chgrp nncp /usr/local/etc/nncp.hjson /var/spool/nncp
      $ chmod g+r /usr/local/etc/nncp.hjson
      $ chmod g+rwxs /var/spool/nncp
      $ echo 'umask: "007"' >>/usr/local/etc/nncp.hjson

- Log format file, for example `/var/spool/nncp/log`. It should be rotated. Choose you own preferable way to do it.

  Example newsyslog’s entry:

      /var/spool/nncp/log		644	7	100	*	BCYN

- Optional incoming directories where uploaded files are stored. Probably you want to run `nncp-reass` from time to time to reassemble all chunked uploads. Example crontab entry:

      */1	*	*	*	*	nncp-reass -all -noprogress

- Possibly long running `nncp-daemon`, `nncp-caller`, `nncp-toss`, `nncp-check` daemons. As all software, they can fail and you should place them under some supervisor control.

  For example you can use daemontools for that task to run them under probably existing `uucp` user:

      # mkdir -p /var/service/.nncp-toss/log
      # cd /var/service/.nncp-toss

      # cat >run <<EOF
      #!/bin/sh -e
      exec 2>&1
      exec setuidgid uucp /usr/local/bin/nncp-toss -cycle 10
      EOF

      # cat >log/run <<EOF
      #!/bin/sh -e
      exec setuidgid uucp multilog t ./main
      EOF

      # chmod -R 755 /var/service/.nncp-toss
      # mv /var/service/.nncp-toss /var/service/nncp-toss

- `nncp-daemon` can also be run as inetd service on UUCP’s port:

      uucp	stream	tcp6	nowait	nncpuser	/usr/local/bin/nncp-daemon	nncp-daemon -quiet -ucspi

- Or it can be also run as a `daemontools` daemon under UCSPI-TCP. In the example below it uses native daemontools’s logging capability:

      # mkdir -p /var/service/.nncp-daemon/log
      # cd /var/service/.nncp-daemon

      # cat >run <<EOF
      #!/bin/sh -e
      NNCPLOG=FD:4 exec envuidgid nncpuser tcpserver -DHRU -l 0 ::0 uucp \
      	/usr/local/bin/nncp-daemon -quiet -ucspi 4>&1
      EOF

      # cat >log/run <<EOF
      #!/bin/sh -e
      exec setuidgid uucp multilog ./main
      EOF

      # chmod -R 755 /var/service/.nncp-daemon
      # mv /var/service/.nncp-daemon /var/service/nncp-daemon