Search code examples
initupstartsystemd

Upstart to Systemd porting


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.


Solution

  • 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