barrier/dist/systemd/barriers.service.in

45 lines
1.6 KiB
SYSTEMD
Raw Normal View History

2020-05-26 02:38:07 +00:00
# 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/db/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
# Sanity check that /var/db exists
ConditionPathExists=/var/db
[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/db/barrier:24800
# SSL data directory
Environment=CERT_DIR=/var/db/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