Link

In the server block, for Host, it is better to use a symbolic hostname (don't use an IP address).

[Server]
	Name = irc.example.ircnow.org
	Host = irc.example.ircnow.org
	Port = 6667
	MyPassword = password12345
	PeerPassword = password12345

Notice that Host = irc.example.ircnow.org and not an IP address like 1.2.3.4. This makes it less work to configure when the other server changes its IP address.

Autostart

To automatically restart ngIRCd if it was terminated unexpectedly, create a script in /usr/local/libexec/project/ngircd.sh:

doas touch /usr/local/libexec/project/ngircd.sh
doas chmod +x /usr/local/libexec/project/ngircd.sh

Inside /usr/local/libexec/project/ngircd.sh:

#!/bin/sh

SERVICE_NAME="ngircd"
SERVICE_USER="_ngircd"
SERVICE_PID="/var/ngircd/var/run/ngircd/ngircd.pid"

if ! pgrep -u $SERVICE_USER -x "$SERVICE_NAME" > /dev/null
then
  if [ -f $SERVICE_PID ]; then
    rm -f $SERVICE_PID
    rcctl -d start $SERVICE_NAME
  fi
fi

Add this as a cronjob:

$ doas crontab -e

*       *       *       *       *       /usr/local/libexec/project/checker_ngircd.sh > /dev/null 2>&1

For the solution to work, you need to enable the use of pid files in /etc/ngircd/ngircd.conf:

PidFile = /var/run/ngircd/ngircd.pid

Make sure to configure hopm.

=== Example ngIRCd server configurations === To illustrate what I mean is, say for example, you have two ngircd servers that you want to connect to each other. Let's say that the server "foo" has this configuration,

[Global]
	Name = irc.foo.org
	Ports = 6667
...
[Server]
	MyPassword = Jp5meaikMiRAKsbBy6G6

Server "bar" has the following configuration,

[Global]
	Name = irc.bar.org
	Ports = 6667
...
[Server]
	MyPassword = HpNSbcDbrTVQ3lkkqSfq
[Server]
	Name = irc.bar.org
	Host = irc.bar.org
	Port = 6667
	MyPassword = Jp5meaikMiRAKsbBy6G6
	PeerPassword = HpNSbcDbrTVQ3lkkqSfq

Likewise under server "bar",

[Server]
	Name = irc.foo.org
	Host = irc.foo.org
	Port = 6667
	MyPassword = HpNSbcDbrTVQ3lkkqSfq
	PeerPassword = Jp5meaikMiRAKsbBy6G6

Sysadmins should have proper password management.

Keep in mind that MyPassword is used for linking with other servers. **It is stored in plaintext and has nothing to do with the server password specified under [Global] section, nor is it related to your [Operator] password!**. When other servers connects to you, they **need** to know **your** MyPassword, in which they will then set it as their PeerPassword on their end. The same thing likewise when you need to peer with them, you **need** to know their MyPassword so that you can set it as **your** PeerPassword.

See how in the example above how irc.foo.org MyPassword is set as Jp5meaikMiRAKsbBy6G6 but when linking with irc.bar.org, whose MyPassword is set as HpNSbcDbrTVQ3lkkqSfq, that irc.foo.org PeerPassword is therefore HpNSbcDbrTVQ3lkkqSfq for linking to irc.bar.org? The same logic also applies in reverse for when irc.bar.org is to link up with irc.foo.org.

=== Summing it up === To sum it up in the prior example, Server irc.foo.org has the following for irc.bar.org,

[Server]
	Name = irc.bar.org
	Host = irc.bar.org
	Port = 6667
	MyPassword = Password_To_Be_Set_On_IRCBARORG's_PeerPassword
	PeerPassword = Password_That_Is_To_Be_received_from_owner_of_IRCBARORG's_MyPassword

and the same likewise, for irc.bar.org when linking to irc.foo.org,

[Server]
	Name = irc.foo.org
	Host = irc.foo.org
	Port = 6667
	MyPassword = Password_To_Be_Set_On_IRCFOOORG's_PeerPassword
	PeerPassword = Password_That_Is_To_Be_received_from_owner_of_IRCFOOORG's_MyPassword