File nikau-server.service of Package nikau
[Unit]
Description=Start nikau KVM server
PartOf=graphical-session.target
After=graphical-session-pre.target gnome-session.target
# Make sure the unit isn't restarted endlessly, see RestartSec= below
StartLimitInterval=60
StartLimitBurst=3
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-%h/.config/nikau/server_environment
ExecStartPre=-/bin/sh -c "echo DISPLAY=${DISPLAY} >/run/user/%U/nikau_server_environment"
ExecStartPre=-/bin/sh -c "echo XAUTHORITY=${XAUTHORITY} >>/run/user/%U/nikau_server_environment"
ExecStartPre=-/bin/sh -c "echo NIKAU_SERVER_OPTS='${NIKAU_SERVER_OPTS}' >>/run/user/%U/nikau_server_environment"
ExecStart=/usr/bin/systemctl start nikau-server@%U.service
#It is recommended to create a polkit rule to allow this without password
ExecStop=/usr/bin/systemctl stop nikau-server@%U.service
ExecStopPost=rm -f /run/user/%U/nikau_server_environment
Restart=on-failure
RestartSec=10
[Install]
WantedBy=graphical-session.target