Is there a way to control two instantiated systemd services as a single unit?

Posted by rascalking on Server Fault See other posts from Server Fault or by rascalking
Published on 2011-11-18T14:39:36Z Indexed on 2012/09/22 15:40 UTC
Read the original article Hit count: 211

Filed under:
|
|
|

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:

[Unit]
Description=AUI Instance on Port %i
After=syslog.target

[Service]
WorkingDirectory=/usr/local/share/aui
ExecStart=/opt/cogo/bin/paster serve --log-file=/var/log/aui/%i deploy-%i.ini        
Restart=always
RestartSec=2
User=aui
Group=aui

[Install]
WantedBy=multi-user.target

And here's the target file:

[Unit]                    
Description=AUI           
[email protected]
[email protected]
After=syslog.target   

[Install]                 
WantedBy=multi-user.target

Is this kind of grouping even possible with systemd?

© Server Fault or respective owner

Related posts about linux

Related posts about fedora