This is a continuation of the minimal NNCP setup to get started. Once we verified that everything works as expected with manual invocations, the next step is automation. There are two options:
the minimal NNCP setup to get started
If you want to enable all the services, the `examples` directory has service definitions for you. Running `nncp-caller` only makes sense if there is at least one entry in your `/etc/nncp.hjson` that has a `cron` key.
sudo systemctl enable /usr/share/doc/nncp/examples/nncp-daemon.service sudo systemctl enable /usr/share/doc/nncp/examples/nncp-caller.service sudo systemctl enable /usr/share/doc/nncp/examples/nncp-toss.service sudo systemctl start nncp-daemon.service sudo systemctl start nncp-caller.service sudo systemctl start nncp-toss.service sudo systemctl status nncp-daemon.service sudo systemctl status nncp-caller.service sudo systemctl status nncp-toss.service
I don't expect a lot of NNCP traffic. This is why my setup on the laptop and server uses the alternative.
In order to conserve resources, you could decide not to have these services running all the time. I'm doing this for two reasons: I don't want to upgrade the virtual machine I'm renting. It's a point of pride to do much with very little. From the perspective of impeding collapse, I also think that we should all get on board with frugal computing (@wim_v12e@scholar.social).
Ready for some frugal computing? Here we go.
Run the daemon on the server. That is, if other sites know your internet address and call you, then you need this. My laptop does not but my server does. When somebody calls the server on port 5400, start the `nncp-daemon` using `inetd` (from the `openbsd-inet` or the `inetutils-inetd` packages on Debian).
In your `/etc/inetd.conf` file:
5400 stream tcp nowait nncp /usr/bin/nncp-daemon nncp-daemon -quiet -ucspi
Run `nncp-call` every hour or every day from cron for the systems you want to call. Those systems don't need a `cron` key in the `/etc/nncp.hjson` file.
This is my laptop calling my server every hour, via `/etc/cron.hourly/nncp`:
#!/bin/sh if [ -x /usr/bin/nncp-call ]; then su nncp -s /bin/sh -c "/usr/bin/nncp-call -noprogress sibirocobombus" fi
This is on the laptop, for my neighbours `erebor` and `quux` in `/etc/cron.daily/nncp`:
if [ -x /usr/bin/nncp-call ]; then for neighbour in erebor quux; do su nncp -s /bin/sh -c "/usr/bin/nncp-call -noprogress $neighbour" done fi
This is for the server, tossing stuff once per hour, via `/etc/cron.hourly/nncp`:
#!/bin/sh if [ -x /usr/bin/nncp-toss ]; then su nncp -s /bin/sh -c "/usr/bin/nncp-toss" fi
Adding `autotoss: true` only helps for the system calling others. On the server, tossing needs to happen on a regular basis.
Finally, you can do some clean-up by copying `/usr/share/doc/nncp/examples/cron-daily-nncp` to `/etc/cron.daily/nncp-cleanup`.
I'm using the following, both on the laptop and the server:
#!/bin/bash if [ -x /usr/bin/nncp-rm ]; then 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" fi
#NNCP