3cky / mbusd

Open-source Modbus TCP to Modbus RTU (RS-232/485) gateway.
BSD 3-Clause "New" or "Revised" License
575 stars 219 forks source link

Use Requires and After to wait for device #116

Open Jalle19 opened 4 days ago

Jalle19 commented 4 days ago

On a Raspberry Pi I configured to act as a gateway, the mbusd@ttyUSB0 service ended up starting way too early in the boot process, before the device was available.

I ran systemctl edit mbusd@ttyUSB0 and added this:

$ cat /etc/systemd/system/mbusd@.service.d/override.conf 
[Unit]
Requires=dev-ttyUSB0.device
After=dev-ttyUSB0.device

Now it correctly waits until the device is available.

I think this would be a good addition to the systemd service, since it's already parametrized.