Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a couple python web services I'm trying to run on a Fedora 15 box. They're being run by paster, and the only difference in starting them is the config file they read.

This seems like a good fit for systemd's instantiated services, but I'd like to be able to control them as a single unit. A systemd target that requires both services seems like the way to approach that. Starting the target does start both services, but stopping the target leaves them running.

Here's the service file:

Description=AUI Instance on Port %i

ExecStart=/opt/cogo/bin/paster serve --log-file=/var/log/aui/%i deploy-%i.ini        


And here's the target file:



Is this kind of grouping even possible with systemd?

share|improve this question
up vote 5 down vote accepted

Look at using the BindTo option to tie the units together. The systemd.unit(5) manual page describes it like this:

       Configures requirement dependencies, very similar in style to
       Requires=, however in addition to this behaviour it also declares
       that this unit is stopped when any of the units listed suddenly
       disappears. Units can suddenly, unexpectedly disappear if a service
       terminates on its own choice, a device is unplugged or a mount
       point unmounted without involvement of systemd.

Which sounds like it should do what you want and tie one unit to the other so that whenever the master stops the slave stops as well and vice versa for starting up.

Don't forget that you can also use Before/After to specify the order in which they should start if necessary.

share|improve this answer
That did the trick...adding BindTo to the service definition brings them up and down in lockstep. Thanks! – rascalking Nov 18 '11 at 15:06
Did you have to add the BindTo to both unit definition files? – Sam Hendley Oct 20 '15 at 22:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.