Systemd

From EggWiki
Jump to navigation Jump to search

In Eggdrop version 1.9.4, an option to create a systemd entry was added to the autobotchk script.

What is systemd

systemd is a software suite that provides an array of system components for Linux[6] operating systems. Its main aim is to unify service configuration and behavior across Linux distributions;[7] Its primary component is a "system and service manager"—an init system used to bootstrap user space and manage user processes.

In other words, it manages what processes need to be started when the host boots, and monitors running processes to see if theey die- and if they do, restart them.

How is systemd different than the traditional cron method used by Eggdrop?

The biggest difference is the lack of a time delay. Traditional cron scripts installed by Eggdrop check if Eggdrop is running via a pidfile. Just maintaining this file by Eggdrop is prone to error. The host runs the checking script every 10 minutes (by default) to see if Eggdrop is running and, if not, will then restart it. This means that, depending on what time Eggdrop crashed (or the machine booted), you could be waiting for almost 10 minutes before your Eggdrop was restarted. Systemd is constantly monitoring the Eggdrop process and will instantly restart it if it crashes.

How do I use systemd with Eggdrop?

Installing systemd job

To install a systemd job, from the directory with your config file, run

./scripts/autobotchk yourBot.conf -systemd

This will install the systemd job and immediately attempt to start Eggdrop.

How do I start/stop/rehash with systemd?

To control Eggdrop, you want to start stop via the systemd job. The "botname" below will match the botnet-nick you set in the config file.

To start Eggdrop:

systemctl --user start <botname>.service

To stop Eggdrop:

systemctl --user stop <botname>.service

To restart Eggdrop:

systemctl --user restart <botname>.service

To rehash Eggdrop:

systemctl --user reload <botname>.service

(Yes, we know the systemd command is reload, but we can't control that. It will NOT reload the Eggdrop, it will rehash the Eggdrop)

To stop Eggdrop from automatically starting:

systemctl --user disable <botname>.service

To re-enable Eggdrop automatically starting:

systemctl --user enable <botname>.service

When will systemd restart Eggdrop?

With a systemd job, it will attempt to restart Eggdrop anytime it detects an abnormal quit condition. This means it will restart if Eggdrop crashes, or the machine is booting for the first time. It will NOT start Eggdrop if Eggdrop was killed via the partyline .die command, a Tcl die command, or if it is killed via the 'kill' OS command.

If you really want Eggdrop to stop running, use

systemctl --user disable <botname>.service

This disables the systemd job.