| Tip of the day: Log files can use JSON logging. You can also send the JSON data to IRCOps on IRC. The JSON is machine readable and contains lots of details about every log event. |
Using systemd with UnrealIRCd
Usually you want to run UnrealIRCd at startup. This can be done via a Cron job but you can also do it via Systemd.
Installing systemd unit file
You have two options here:
- System unit: this is usually what people use. It requires root but on the plus side it allows a couple of extra security measures.
- User unit: this does not require root on the machine, and you can run all commands to start/stop/restart the ircd as the same user as the ircd is running at, so is actually quite convenient.
System unit
In the directory where you compiled UnrealIRCd at, for example ~/unrealircd-6.2.1/ go to the subdirectory extras/startup and open the file unrealircd.service in an editor. Change the User= and Group= lines to match the user/group you user for running the ircd, and change the path in ExecStart= if needed. Save the file
Finally, run the following as root:
cp -av unrealircd.service /etc/systemd/system/ systemctl daemon-reload systemctl enable unrealircd.service systemctl start unrealircd.service
User unit
If instead, you prefer to use the user unit, then go to the directory where you compiled UnrealIRCd at, for example ~/unrealircd-6.2.1/ and go to the subdirectory extras/startup. Open the file unrealircd_user.service in an editor. Change the ExecStart= line if needed (by default it assumes unrealircd is installed in ~/unrealircd/).
Then, run the following commands:
loginctl enable-linger mkdir -p ~/.config/systemd/user cp unrealircd_user.service ~/.config/systemd/user/unrealircd.service systemctl --user daemon-reload systemctl --user enable unrealircd.service systemctl --user start unrealircd.service
Starting and stopping UnrealIRCd
Now that you are using systemd to manage UnrealIRCd, you can no longer use the ./unrealircd [start|stop|restart] commands. Instead, you should use:
- If using the system service, as root or via sudo:
systemctl [start|stop|restart] unrealircd - If using the user service:
systemctl --user [start|stop|restart] unrealircd
You can still use ./unrealircd commands other than start/stop/restart, like ./unrealircd rehash or ./unrealircd status