13.07.2017 03:38, Paul D. DeRocco пишет:
> I've created a serial-getty@ttyUSB2.service file, which is basically a
> copy of serial-getty@.service with a specific device name and a fixed baud
> rate. It works fine when I plug in a serial dongle that gets assigned that
> name. (I have permanent ttyUSB0 and ttyUSB1 devices which don't use
> getty.)
> 
> If I logout, it just offers me a new login prompt. If I unplug the dongle,
> the automatic retrying fails, and plugging it in again doesn't bring it
> back to life.
> 
> If I use Restart=no, then I can terminate it either by logging out or
> yanking the dongle, but it naturally won't restart if I plug the dongle in
> again. Is there a way of configuring the service to start every time the
> dongle is inserted, whether I logged out before yanking the dongle or not?
> Or does this require some special udev rule?
> 

Yes, set ENV{SYSTEMD_WANTS}="serial-getty@ttyUSB2.service" property on
your device in udev rule; this will trigger starting of this service
when device appears. You probably also want to add
"BindsTo=dev-ttyUSB2.device" (or whatever name of your device unit is)
so systemd stops it when dongle is unplugged and does not attempt to
restart.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to