When to use wants instead of requires in systemd?

When to use wants instead of requires in systemd?

Often, it is a better choice to use Wants= instead of Requires= in order to achieve a system that is more robust when dealing with failing services. A space-separated list of unit names. Configures ordering dependencies between units.

What’s the difference between after and before in systemd?

If a unit foo.service requires a unit bar.service as configured with Requires= and no ordering is configured with After= or Before=, then both units will be started simultaneously and without any delay between them if foo.service is activated.

What happens if a systemd goes down on its own?

However, if it goes down on its own, you will not stop, as there was no job, and the state change happened without systemd’s involvement. That’s where you would use BindsTo= (similar to device units, which can go to inactive without systemd’s involvement, for obvious reasons).

What happens when a unit is deactivated in systemd?

Configures requirement dependencies on other units. If this unit gets activated, the units listed here will be activated as well. If one of the other units gets deactivated or its activation fails, this unit will be deactivated.

Why does systemd not start foo.service without after =?

If one of the other units fails to activate, and an ordering dependency After= on the failing unit is set, this unit will not be started. Essentially, this means that without After=, both services will be started if foo.service is started (because of Requires= ), but systemd will not stop foo.service if bar.service does not start successfully.

How to understand what a systemd target wants?

The file /lib/systemd/system/graphical.target contains: [Unit] Description=Graphical Interface Documentation=man:systemd.special (7) Requires=multi-user.target Wants=display-manager.service Conflicts=rescue.service rescue.target After=multi-user.target rescue.service rescue.target display-manager.service AllowIsolate=yes