2

I have this line in an upstart conf file:

start on starting service1 or stopped service2
stop on stopping service1

How can this be translated to systemd unit target? I've searched for any kind of disjunction support but I couldn't find one.

1 Answers1

2

When service2 is started, service1 should also be started. This relation can be implemented using Requires In service2's unit config file, add

Requires=service1.service

But this will start both services in parallel when you run a command to start service2. To control the order in which the services start, you need to use Before or After

More on it here

Thirupathi Thangavel
  • 2,418
  • 3
  • 29
  • 49
  • 2
    Got it eventually. So you have 2 notions for systemd: dependency and ordering. The only predicates that establish ordering are "After" and "Before". If neither is specified a dependent service will be started in parallel with the one that sets the dependency. Thanks @t_thirupathi! – SabinManiac Oct 07 '15 at 15:40
  • 1
    For the "or" I just use ExecStopPost in service2 with "systemctl start" cmd. – SabinManiac Oct 09 '15 at 06:12