TEXT   20
Using Systemd Service Management
Guest on 12th March 2023 09:06:31 AM


  1. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. Using Systemd Service Management
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4.  
  5. .. include:: prologue.rst
  6.  
  7. .. |configuration directory| replace:: /usr/lib
  8. .. |unit directory| replace:: |configuration directory|/systemd/system
  9. .. |scripts directory| replace:: |configuration directory|/brltty
  10. .. |users directory| replace:: |configuration directory|/sysusers.d
  11. .. |files directory| replace:: |configuration directory|/tmpfiles.d
  12. .. |build subdirectory| replace:: Autostart/Systemd
  13. .. |default configuration file| replace:: ``/etc/brltty.conf``
  14.  
  15. Initial Setup
  16. =============
  17.  
  18. The following steps need to be performed:
  19.  
  20. * Systemd service and path units need to be installed
  21.   into the |unit directory| directory:
  22.  
  23.   + brltty@.service
  24.   + brltty-device@.service
  25.   + brltty.path
  26.   + brltty@.path
  27.  
  28. * A wrapper script needs to be installed
  29.   into the |scripts directory| directory:
  30.  
  31.   + systemd-wrapper
  32.  
  33. * A file defining the non-root user that BRLTTY is to run as,
  34.   including the supplementary groups that it needs access to,
  35.   needs to be installed into the |users directory| directory:
  36.  
  37.   + sysusers -> brltty.conf
  38.  
  39. * A file defining the files and directories that should exist
  40.   needs to be installed into the |files directory| directory:
  41.  
  42.   + tmpfiles -> brltty.conf
  43.  
  44. A make file has been provided in order to make this easy to do.
  45. It can be found within the |build subdirectory| subdirectory
  46. of BRLTTY's build tree.
  47. To install all of these files, change to this directory and run the command::
  48.  
  49.   make install
  50.  
  51. You then need to tell Systemd that the files have been installed.
  52. To do this, run the command::
  53.  
  54.   systemctl daemon-reload
  55.  
  56. That's all you need to do.
  57. Your system is now able to manage BRLTTY instances via Systemd.
  58.  
  59. Managing BRLTTY Instances
  60. =========================
  61.  
  62. Systemd manages BRLTTY instances on your system in a number of ways.
  63.  
  64. USB Braille Devices
  65. -------------------
  66.  
  67. If BRLTTY's Udev rules have also been installed
  68. then a BRLTTY instance will be automatically started
  69. when a USB braille device is connected,
  70. and automatically stopped when it's disconnected.
  71. Several braille devices can be managed in this way at the same time.
  72. They can be connected and disconnected at any time and in any order.
  73.  
  74. The default configuration file - |default configuration file| - is used
  75. except that any ``braille-device`` and ``braille-driver`` directives
  76. that it specifies are ignored because they're overridden by the Udev rules.
  77. It's safe, therefore, to specify a default non-USB braille device
  78. within |default configuration file|.
  79.  
  80. The Default Instance
  81. --------------------
  82.  
  83. The default BRLTTY instance is the one that's configured
  84. via the file |default configuration file|.
  85. It's managed by applying standard Systemd commands to BRLTTY's path unit.
  86. For example::
  87.  
  88.   systemctl enable brltty.path
  89.   systemctl start brltty.path
  90.   systemctl stop brltty.path
  91.   systemctl disable brltty.path
  92.  
  93. Additional Instances
  94. --------------------
  95.  
  96. Additional BRLTTY instances can be managed via path instance references.
  97. Each of them has its own configuration file.
  98.  
  99. If, for example, the name of an instance is ``iname``, then
  100. its Systemd path name would be ``brltty@iname``,
  101. its configuration file would be ``/etc/brltty_iname.conf``,
  102. and it'd be managed via Systemd commands like these::
  103.  
  104.   systemctl enable brltty@iname.path
  105.   systemctl start brltty@iname.path
  106.   systemctl stop brltty@iname.path
  107.   systemctl disable brltty@iname.path
  108.  
  109. Any number of instances may be managed in this way.
  110. These instances don't implicitly also read the default configuration file
  111. (|default configuration file|).
  112. You can, however, explicitly include it
  113. from within any instance-specific configuration file:
  114.  
  115. .. parsed-literal:: include |default configuration file|

Raw Paste

Login or Register to edit or fork this paste. It's free.