[systemd-devel] Add unit to arbitrary target.

Andrey Borzenkov arvidjaar at gmail.com
Tue Jan 28 21:50:00 PST 2014


On Wed, Jan 29, 2014 at 9:23 AM, dE <de.techno at gmail.com> wrote:
> On enabling a unit, by default systemd will put it in a target which has
> been specified in by the unit itself.
>
> Is there any way by which I can make the unit start in any custom target?
> Manual linking or using systemctl?

Just use manual links. Create directory
/etc/systemd/{system,user}/foo.target.wants and link to your unit
there. The name is better be the same as original unit name with
exception of templates (I do not think it is enforced right now but it
may be in the future).

Or if you know in advance which units should be started by your
target, just list them in Wants= directive in your target unit.


More information about the systemd-devel mailing list