Suppose I have two different "runlevels" setup via "targets" in systemd
- before.target
(a minimum bootstrap set of services enabled) and after.target
(run everything).
Right now I do this when I want to switch from "before" to "after":
# Set default to after.target.
/usr/bin/systemctl set-default after.target 1>/dev/null
# Before reboot make sure essential services are enabled
/usr/bin/systemctl enable foo bar baz buz 1>/dev/null
# Reboot
reboot
How can I get foo.service
, bar.service
, baz.service
, and buz.service
added to after.target
when they are installed?
If I want to configure boz
to run when after.target
is enabled, is there any way to do that without modifying the /usr/lib/systemd/system/after.target
file?
In older systems with chkconfig I would just enable the bootstrap services on say, runlevel 4, and then enable all other services on runlevel 3 but I'm having trouble figuring out how to do that here and would prefer not to have to hardcode in Wanted-By: after.target
in all my service files.