Skip to content

Support service start dependency pattern “B starts after A exits” #712

@jy5275

Description

@jy5275

Our SONiC on Ubuntu needs to control the service start sequence with patterns such as: B starts after A has exited.

According to the Pebble documentation on service start order, the suggested pattern is: bash -c 'run-service-a && run-service-b'

However, this approach does not work for fanout dependency patterns where multiple services depend on one service’s completion.
To achieve similar behavior, we currently have to use a workaround as below:

Supervisord config (current SONiC community behavior)

[programstart]
dependent_startup_wait_for=rsyslogd:running
[program:lldpd]
dependent_startup_wait_for=start:exited
[program:lldpmgrd]
dependent_startup_wait_for=start:exited

Pebble config (workaround):

start::
  command: bash -c "/usr/bin/start.sh && touch /tmp/start_ok"
  after: [ rsyslogd ]
lldpd:
  command: bash -c "test -f /tmp/start_ok && exec /usr/sbin/lldpd"
lldpmgrd:
  command: bash -c "test -f /tmp/start_ok && exec /usr/bin/lldpmgrd"

This workaround causes excessive error logs because downstream services repeatedly retry and fail until the upstream service exits. It makes troubleshooting difficult. We would like pebble to support a native dependency pattern where a service can start after another service has exited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    26.04An item we hope to do in the 26.04 cycleneeds designNeeds more thought or a specroadmapAn official roadmap item

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions