You are not logged in.
Pages: 1
Systemd services can be declared to have dependencies. For example, a.service may require b.service, which means that whenever a.service gets started, b.service gets started, too.
Is there a way of making those dependencies more dynamic?
For example, let's say that I'd like a.service to depend on morning.service in the morning, and afternoon.service in the afternoon? Or some other condition, like whether I'm connected via WiFi or ethernet, or whatever.
I've tried to manage this manually, by having the a.service script execute
systemctl start b.service
during its own activation, but systemd ends up in a deadlock if I do that. My next attempt will be to do the same, but as a background process in the hope that this avoids the deadlock.
But is there a better way?
Offline
I think that most of those things don't need a dynamically changing systemd service. They would need the activation of the right services. In my (admittedly limited) understanding of systemd, services are meant to be just that. A service running in the background with control signals coming from different parts of the system. It is meant to make sure that the needed dependencies for the software are solved.
I think that your problem is better solved using timers and something like udev to control which services are run on arbitrary conditions. Maybe targets are also useful in this case.
Offline
Pages: 1