###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
#          text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2017 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version. Please see the file LICENSE-GPL for details.
#
# Web Page: http://brltty.com/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################

[Unit]

Description=BRLTTY Instance: %I
Documentation=man:brltty(1)
Documentation=@PACKAGE_URL@

ConditionPathExists=%I
RequiresMountsFor=@UPDATABLE_DIRECTORY@
RequiresMountsFor=@api_socket_directory@
DefaultDependencies=no

After=local-fs.target
Before=sysinit.target

Wants=systemd-udev-settle.service
After=systemd-udev-settle.service

StopWhenUnneeded=true
RefuseManualStart=true
RefuseManualStop=true


[Service]

Environment="BRLTTY_SYSTEMD_INSTANCE=%I"
ExecStart=/sbin/brltty-systemd-wrapper

Type=@SYSTEMD_SERVICE_TYPE@
Environment="BRLTTY_EXECUTABLE_ARGUMENTS=@SYSTEMD_SERVICE_ARGUMENTS@"

PIDFile=%t/brltty-%i.pid
Environment="BRLTTY_PID_FILE=%t/brltty-%i.pid"

TimeoutStartSec=5
TimeoutStopSec=10

Restart=on-failure
RestartSec=30

Nice=-10
OOMScoreAdjust=-900


