[systemd-devel] How to start a service when a device is created under /dev/pts/
Giuseppe Sacco
giuseppe at sguazz.it
Mon Feb 13 13:21:22 UTC 2023
Il giorno lun, 13/02/2023 alle 12.12 +0200, Mantas Mikulėnas ha
scritto:[...]
> I'm not entirely sure whether it even makes sense for a .service unit
> to wait for a specific pty? I mean, the entire design of ptys is that
> they're assigned on a first-come basis and there's no way for a process
> to claim a specific pty for itself, so there's no way for
> faxgetty at .service to be sure that pty/0 is your fax thing and not e.g.
> someone's xterm or an incoming SSH connection.
>
> What is supposed to be creating /dev/pts/0 in your case? It might be
> simplest to have the same software directly start
> faxgetty@<ptyname>.service as well.
In this scenario, the ptys are created by software like iaxmodem (that uses
asterisk) when its daemon starts. Some more information is available at
Debian bug 1031200 (http://bugs.debian.org/1031200) and a suggested
solution is to change the unit and depend on the pty daemon service and on
the a file system link in /dev that points to the real device in /dev/pty/
(the link being created by the pty service at startup time).
Something like:
[Unit]
Description=HylaFAX faxgetty %I
Wants=iaxmodem.service dev-%i.device
Bye,
Giuseppe
More information about the systemd-devel
mailing list