Skip to content

Running as a Linux Service

Seth Hendrick edited this page Jul 9, 2017 · 2 revisions

Holy War Disclaimer: These are instructions on how to run Chaskis as a service via systemd. SysVinit is not supported, nor do I plan on adding support anytime soon. Since systemd vs SysVInit is a holy war, I should say that the main reason why I only support systemd is simply because I don't have any SysVInit systems, they are all systemd.

1. Pick a user

Create or pick a user (or users) that will run Chaskis has a service. Chaskis's service is limited to one Chaskis instance per user.

2. Bootstrap and Configure

While logged in as the user that will run Chaskis as a service, run chaskis --bootstrap. This will put a default configuration in /home/yourUser/.config/Chaskis. Edit the configuration files in side as desired.

3. Enable/Start the Systemd service.

While logged in as the user, run systemctl --user enable chaskis. This enables the service. To start the service, run systemctl --user start chaskis.

You will need to login as the user directly, sudo su yourUser is not enough. Logging in as a different user via su does not enable dbus for that user, which means that if you try to enable the systemd service, you'll get an Failed to connect to bus: No such file or directory error.

You may also need to enable linger for that user, so when the user logs out the service does not stop. sudo loginctl enable-linger yourUser will do just that.

Note: While the service is running, a yourUser.chaskis.lock appears in /tmp. This file is generated by mono-service. Do not delete this file, it contains the PID. When the service stops, we grab the PID in this file and kill the service via that PID.