The care and feeding of an NNCP installation.
NNCP needs little care, but it there are a few things that can help.
NNCP’s administration page is a good place to read about this. My Debian packages do some of this for you, and provide examples for much of the rest as well.
Rotate the log file
NNCP has a log file, which by default is under the spool directory (/var/spool/nncp
by default). This can be rotated by something like logrotate. I ship this example with Debian:
/var/spool/nncp/log
{
rotate 14
daily
missingok
notifempty
compress
delaycompress
su nncp nncp
}
Clean up cruft
There are some files that NNCP creates that can be cleaned up using nncp-rm beginning with NNCP version 8.7.2. I ship this example with Debian:
#!/bin/bash
for TYPE in part seen hdr area; do
su nncp -s /bin/bash -c "nncp-rm -quiet -all -older 7d -$TYPE"
done
su nncp -s /bin/bash -c "nncp-rm -quiet -tmp -older 7d"
Cleaning up packets themselves
NNCP by default only removes packets under these circumstances:
- tx packets, when they have been transmitted (confirmation from nncp-call/caller/daemon, sent with nncp-xfer, or ACKed by nncp-ack)
- rx packets, when they have been successfully processed by nncp-toss
(See NNCP Concepts for more on these ideas)
There are some circumstances in which packets could accumulate:
- rx packets that cause errors in processing. Examples could include requesting to run a command they’re not allowed to, executing a command that exits with an error, trying to send a file to a machine that doesn’t allow files from that node, and so forth. Some of these conditions may never be resolved, so a packet could linger forever.
- tx packets waiting to be picked up from a node that no longer exists or something.
Many people will never encounter these situations. The examples above do not actually delete any packets; they are non-destructive. I don’t necessarily recommend automatic packet deletion in most cases. But if you really want to delete these automatically, you can:
su - nncp -s /bin/bash -c "/usr/local/bin/nncp-rm -all -rx -older 4d"
su - nncp -s /bin/bash -c "/usr/local/bin/nncp-rm -all -tx -older 10d"
Links to this note
NNCP lets you securely send files, or request remote execution, between systems. It uses asynchronous communication, so the source and destination need never be online simultaneously. NNCP can route requests via intermediate devices – other NNCP nodes, USB sticks, tapes, radios, phones, cloud services, whatever – leading to a network that is highly resilient and flexible. NNCP makes it much easier to communicate with devices that lack Internet connectivity, or have poor Internet.