Grouping Systemd Services – Configuration Guide

systemd

I've written about half a dozen .service files for the different parts that make up the system I'm working on. It's useful to be able to start the whole system piecemeal but I'd also like to have a single unit that starts the whole system in one call to systemctl.

What's the best way to do this?

Best Answer

You want a target-type unit, with all the service units listed as Wants= dependencies. Then you start it using systemctl start unitname.target. (Make sure not to use systemctl isolate here; that will shut down everything except what's in your services' dependency tree, which you presumably don't want.)

Related Question