5 Service files
Minecraftchest1 edited this page 2022-04-04 09:17:14 -05:00

SystemD

A sample systemd unit to run matterbridge in the background, restarting if necessary.

/etc/systemd/system/matterbridge.service, remember to correct ExecStart= and User=

[Unit]
Description=Matterbridge daemon
After=network-online.target

[Service]
Type=simple
ExecStart=/path/to/your/matterbridge/binary -conf /path/to/your/matterbridge.toml
Restart=always
RestartSec=5s
User=matterbridge

[Install]
WantedBy=multi-user.target

Reload systemd with sudo systemctl daemon-reload, enable on system start and now with sudo systemctl enable --now matterbridge.service

OpenRC

A sample OpenRC service to run matterbridge in the background.

/etc/init.d/matterbridge

#!/sbin/openrc-run
# Copyright 2021-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

command=/usr/bin/matterbridge
command_args="-conf ${MATTERBRIDGE_CONF:-/etc/matterbridge/matterbridge.toml} ${MATTERBRIDGE_ARGS}"
command_user="mattermost:mattermost"
pidfile="/run/${RC_SVCNAME}.pid"
command_background=1

depend() {
    need net
}

Enable with sudo rc-update add matterbridge default

Start with sudo rc-service matterbridge start