TL;DR: More toying with mobile broadband and systemd; would like help
automatically stopping service depending on device availability.
I’ve been adjusting the .service file for netcfg(a)ppp-mobile.service so
it plays nicely with my modem. It will only start if the USB modem is
plugged in and exposing a serial port to the computer, and when I
manaually stop the unit, the ppp daemon is also killed, so it doesn’t
lock the device and reconnect automatically upon the device being
detected again, thus *bringing up the network interface when systemd and
netcfg say it is down*.
Description=Netcfg networking service for mobile broadband point
What I cannot figure out how to do is automatically stop the service if
the device is unplugged, similar to how ifplugd works for wired ethernet
I’ve read the manual pages and asked Google, and I cannot seem to find
more detailed information. I think it may be possible to write a service
that will use udev’s polling capabilities, but then I have to somehow
link that unit to the netcfg one such that it gets stopped and started
when netcfg is, which implies it would listen to udev, wait for the
device to be unplugged, then stop netcfg and kill itself.
systemd's PartOf= may offer an answer, but I don’t really know how to
tie it all together.
How should I best go about this? Another systemd service, a udev rule,
or is it possible to further modify the ppp-mobile service?