barrier/dist/systemd/barriers.service.in

43 lines
1.5 KiB
SYSTEMD

# Barrier Server service barriers-@BARRIER_VERSION@
#
# This file is part of Barrier.
#
# This systemd service starts barrier on the default port 24800.
#
# SSL data is stored in /var/lib/barrier:24800/barrier/SSL
[Unit]
Description=Barrier Server listening on 24800 (Open-source KVM software)
Documentation=man:barriers(1) man:barrierc(1)
Documentation=https://github.com/debauchee/barrier/wiki
# Require network before starting barrierc
After=network-online.target
Wants=network-online.target
# Don't run server if client or another instance is running
Conflicts=barrierc@.service barriers@.service
[Service]
Type=exec
# Log level may be FATAL, ERROR, WARNING, NOTE, INFO, DEBUG, DEBUG1, DEBUG2
Environment=LOG_LEVEL=INFO
# Default display is :0
Environment=DISPLAY=:0
# Store SSL data in instance specific directories
Environment=XDG_DATA_HOME=/var/lib/barrier/barrier:24800
# SSL data directory
Environment=CERT_DIR=/var/lib/barrier/barrier:24800/barrier/SSL
# Create the certificate directory
ExecStartPre=mkdir -p ${CERT_DIR}
# Create the Barrier.pem certificate if it doesn't exist
ExecStartPre=sh -c "[ -f ${CERT_DIR}/Barrier.pem ] || openssl req -x509 -nodes -days 365 -subj '/CN=Barrier' -newkey rsa:2048 -text -keyout ${CERT_DIR}/Barrier.pem -out ${CERT_DIR}/Barrier.pem"
# Main executable
ExecStart=/usr/bin/barriers --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --config /etc/barrier.conf --no-daemon --address :24800
# Restart on fail
Restart=always
[Install]
# Install to graphical target
WantedBy=graphical.target