systemd Configs

You can run cobald as a system service. We provide systemd configs for multiple cobald instances run as services. You can manage several instances which are identified with a systemd instance name.

Create a file named cobald@.service in the /usr/lib/systemd/system directory.

An example of a systemd config file:

[Unit]
Description=COBalD - the Opportunistic Balancing Daemon for %I
Documentation=https://cobald.readthedocs.io
After=network.target
Wants=network-online.target
After=network-online.target

[Install]
RequiredBy=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/python3 -m cobald.daemon /etc/cobald/%i.py

In this example, the configs for the different COBalD instances are located at /etc/cobald/instance-name.py. cobald can handle .py and .yaml configuration files. Please ensure that the chosen python interpreter has cobald installed! We recommend to use a virtualenv. By using a virtualenv you have to set the ExecStart to ExecStart={{ virtualenv }}/bin/python -m cobald.daemon /etc/cobald/%i.yaml.

After you created or changed the file you need to run:

$ systemctl daemon-reload

Now you can manage the cobald instance which loads the /etc/cobald/instance-name.py config file.

  • start one instance of cobald

    $ systemctl start cobald@instance-name
    
  • stop the instance of cobald

    $ systemctl stop cobald@instance-name
    
  • report the current status of the cobald instance

    $ systemctl status cobald@instance-name
    
  • enable cobald instance start at boot time

    $ systemctl enable cobald@instance-name