Hi, I was recently working on an embedded system that had a daemon that depended on the presence of two USB serial devices. The daemon needed to be run when both devices were plugged in. If any of the devices was unplugged, the daemon would exit, and would need to be restarted the next time both devices were plugged in.
I created a service file pretty-much like the one at the end of this email. This kind-of did what I wanted for a short while. However, if the daemon was running, and then I unplugged the serial devices, systemd seemed to attempt to continuously restart the daemon despite the serial devices not being present. Furthermore, it seemed to give up doing this after some period of time (not sure exactly how long, but somewhere around minute or two). Once it had given up restarting the daemon, the daemon was not restarted when I plugged the devices back in again. In the end, due to looming deadlines, I added a cron job that just ran `systemctl start mydaemon.service` every minute to ensure that systemd didn't give up on reactivating the service. Am I missing something here? Is this a valid application of systemd? Oh, and this is with systemd-44 (Fedora systemd-44-17.fc17.i686). Cheers, Rob --- [Unit] Description=... Requires=dev-serial-a.device Requires=dev-serial-b.device After=dev-serial-a.device After=dev-serial-b.device [Service] ExecStart=/usr/bin/my-magic-service Type=notify NotifyAccess=main TimeoutSet=5s Restart=always RestartSec=1s WatchdogSec=1500ms StartLimitInterval=0 [Install] WantedBy=multi-user.target
signature.asc
Description: This is a digitally signed message part
_______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
